Docker Commands

Commands Flags/Options Descriptions
docker image ls List all of the images in local docker instance
docker container ls list running containers
--all list all(running/non-running)containers
docker build <directory> build docker image.Default dir=current dir
-t Tag docker container with format {repo}/{image-name}:{version}
docker run <container> run docker container
-p {host-port}:{container-port} specify ports to expose
-d detached mode
--name give name to the running container
docker container stop <container-id/name> stop running container
docker container kill <container-id/name> kill running container
docker tag <image> <repo>/<image-name>:<tag> tag docker image
docker system prune delete unused images
-a,--all delete all images that are not attached to currently running containers
docker rmi <image-name> delete docker image
docker exec <container-name> env get all environment variables from running container