Docker Hot Tips

Docker build container

docker build ./ -t “<name>:<version>” –platform=linux/amd64

SSH into a container

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

R…


This content originally appeared on DEV Community and was authored by Yur-ii

Docker build container

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

SSH into a container

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

Remove: all containers & all images

# List all containers (only IDs)
docker ps -aq

# Stop all running containers
docker stop $(docker ps -aq)

# Remove all containers
docker rm $(docker ps -aq)

# Remove all images
docker rmi $(docker images -q)

docker-compose build

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

docker-compose up

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

docker-compose down

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

Use for notes:

https://notepad.site/


This content originally appeared on DEV Community and was authored by Yur-ii


Print Share Comment Cite Upload Translate Updates
APA

Yur-ii | Sciencx (2021-12-23T11:42:56+00:00) Docker Hot Tips. Retrieved from https://www.scien.cx/2021/12/23/docker-hot-tips/

MLA
" » Docker Hot Tips." Yur-ii | Sciencx - Thursday December 23, 2021, https://www.scien.cx/2021/12/23/docker-hot-tips/
HARVARD
Yur-ii | Sciencx Thursday December 23, 2021 » Docker Hot Tips., viewed ,<https://www.scien.cx/2021/12/23/docker-hot-tips/>
VANCOUVER
Yur-ii | Sciencx - » Docker Hot Tips. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/12/23/docker-hot-tips/
CHICAGO
" » Docker Hot Tips." Yur-ii | Sciencx - Accessed . https://www.scien.cx/2021/12/23/docker-hot-tips/
IEEE
" » Docker Hot Tips." Yur-ii | Sciencx [Online]. Available: https://www.scien.cx/2021/12/23/docker-hot-tips/. [Accessed: ]
rf:citation
» Docker Hot Tips | Yur-ii | Sciencx | https://www.scien.cx/2021/12/23/docker-hot-tips/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.