- How to load a docker image file
$ docker load -i <filename.tar>
- How to save loaded Docker image to a docker image file (no compression)
$ docker save -o my_docker_file.tar loaded_image_name:version
With compression$ docker save loaded_image_name:version | gzip > filename.tar.gz
- How to start a container from a loaded image and see its log
$ docker up
How to start a container from a loaded image in detached mode$ docker up -d
- How to list all containers in short format
$ docker ps --format "{{.ID}}\t{{.Names}}"
- How to see a container's IP address
$ docker inspect <container_id> | grep IPAddress
- How to stop container only.
$ docker down
How to stop a container and remove its volume (remove saved data)$ docker down -v
How to remove a stopped container$ docker rm <container_id>
How to remove all stopped containers$ docker container prune
How to remove all stopped containers and remove their data$ docker system prune
- How to go inside a container (non distroless)
$ docker exec -it <container_name> bash
- How to log in to a postgres container?
$ docker exec -it <container_id> psql -d <table_name> -U <username>
- How to reset password?
$ docker exec -it <container_name> python3 manage.py changepassword <email_id>
Frequently Used Commands for Docker
Written: 2021-10-19 18:46:22
Last update: 2023-05-22 15:05:57
Search more info