Posts

Showing posts with the label docker

Adding not root user to Docker container

 Adding not root user to Docker container  in docker file: ARG USERNAME=containeruser ARG USER_UID=1000 ARG USER_GID=$USER_UID RUN groupadd --gid $USER_GID $USERNAME \     && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \     && chown -R $USER_UID:$USER_GID /home/$USERNAME     # [Optional] Add sudo support if needed     # && apt-get update && apt-get install -y sudo \     # && echo $USERNAME ALL=(root) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \     # && chmod 0440 /etc/sudoers.d/$USERNAME # Set the default user for all processes in the container (optional, but ensures everything runs as this user) # USER $USERNAME

Cleaning the Docker (Чистим докер или тотальная нехватка места на жестком диске)

Image
  Чистим докер или тотальная нехватка места на жестком диске Удаление образов, контейнеров и томов Docker Prune unused Docker objects How To Remove Docker Containers, Images, Volumes, and Networks для тех кто не любит много читать - рецептик: (Docker - How to cleanup (unused) resources Все операции по чистке докера должны быть обдуманными, автор не несет ответственности за Ваши потерянные данные в докер контейнерах )).

Docker tips & tricks

Image
Docker tips & tricks 1. one-line command for build & run container at once      docker-compose up -d --build -d means in background (daemon)  2.  speedup docker builds 3.  Rebuild containers using docker compose when dockerfile changes           docker-compose up --force-recreate 4.   If I have a bad deploy this may help      docker-compose build --no-cache 5. R emove all images      docker-compose down --rmi ("local"|"all") 6. Automatically update services with file watch  in Docker Compose ( experimental,  Docker Desktop 4.24.0 said that this feature is now open for all )             docker-compos up --watch 7. Removing containers with the data ( be careful, you will lose all your data for the containers that are ...

Speedup docker builds (ускоряем билды докера)

docker-compose build --parallel