Created
April 16, 2019 05:12
-
-
Save adifahmi/35d8647ce9fea082f415fb36dc0442b9 to your computer and use it in GitHub Desktop.
Some docker commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Build image from Dockerfile | |
docker build --pull --no-cache -t <IMAGE_NAME> . | |
Run image | |
docker run <IMAGE_NAME> | |
Stop container | |
docker stop <CONTAINER_ID> | |
List all container | |
docker container -a | |
(-a is optional to show all) | |
Inspect container (can be used to get network) | |
docker inspect <CONTAINER_ID> | |
Remove all dangling image | |
docker rmi $(docker images -f "dangling=true" -q) | |
Remove all exited container | |
docker rm $(docker ps -a -f status=exited -q) | |
Remove all images (can't remove image that has running container) | |
docker rmi $(docker images -a -q) | |
Remove single image | |
docker rm <IMAGE_ID> | |
List all images | |
docker images -a | |
Build Dockerfile and run it with docker-compose | |
docker-compose up | |
Rebuild docker compose | |
docker-compose up --build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment