An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
December 23, 2021 11:42 am GMT
Original Link: https://dev.to/falselight/docker-tips-5fll
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:
Original Link: https://dev.to/falselight/docker-tips-5fll
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To