Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 23, 2021 11:42 am GMT

Docker Hot Tips

These tips will be useful for developers who are already familiar with docker and understand the fundamental principle behind it. In my opinion, these are the hottest tricks for the newcomer who for some reason has not yet memorized these commands.

PLC - Peace! Love! Code!

Docker build container

docker build ./ -t "<name>:<version>" --platform=linux/amd64

SSH into a container

docker exec -it <mycontainer> bash# ordocker exec -it <mycontainer> sh

Remove: all containers & all images

# List all containers (only IDs)docker ps -aq# Stop all running containersdocker stop $(docker ps -aq)# Remove all containersdocker rm $(docker ps -aq)# Remove all imagesdocker rmi $(docker images -q)

docker-compose build

# --build-arg ENV_VAR=<value> - add argsdocker-compose --project-name "<name>" build \--build-arg ENV_VAR=<value>

docker-compose up

# -d - Detached mode: Run containers in the backgrounddocker-compose --project-name "<name>" up -d

docker-compose down

docker-compose --project-name "<name>" down

Use for notes:

https://notepad.site/


Original Link: https://dev.to/falselight/docker-tips-5fll

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To