docker commands
Command | Description |
---|---|
docker tag <old_name> <new_name> followed by docker rmi <old_name> | Rename an image: Essentially 2 steps, first tag a different image with the old name:tag & then remove the image with the old name (the older one is now tagless) |
docker rmi <IMAGE ID> | Remove/delete an image |
docker save <repo/image:tag> -o <filename.tar.gz> | Saving an image from local repo as a tar file |
docker load < <filename.tar.gz> OR docker load --input <filename.tar.gz> | Load an image into local repo from a tar file |
Command | Description |
---|---|
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] | To run an image as a container, modify it and then save modified image Make sure you don't run it with --rm , else the container will disappear and we can't commit after exiting Commiting with modified CMD & EXPOSE instructions: https://docs.docker.com/engine/reference/commandline/commit/#commit-a-container-with-new-configurations |
docker rm <container name>
| removes the container
Command | Description |
---|---|
docker ps | Lists the running containers (instances) |
docker ps -a | Lists all (running and stopped) containers (instances) |
docker image ls | Lists all images in the local repo |