Skip to content

Instantly share code, notes, and snippets.

@mkfares
Last active July 29, 2020 10:11
Show Gist options
  • Save mkfares/52add9c465da0b4d8c5475926bd14208 to your computer and use it in GitHub Desktop.
Save mkfares/52add9c465da0b4d8c5475926bd14208 to your computer and use it in GitHub Desktop.
Docker Managing Images

Managing Docker Images

Image names

The image name is composed of two parts that are separated by a colon (:) repository:tag. For instance, in the image name alpine:3.12, the repository is alpine and the tag is 3.12. The default tag is latest if it is omitted from the image name. For example, alpine is equivalent to alpine:latest.

Pull images from Docker Hub Registry

$ docker image pull alpine
$ docker image pull alpine:3.12

List locally downloaded images

$ docker images
$ docker image ls

Show the history of images

$ docker images history alpine

Create tagged image from another image

$ docker image tag alpine myimage
$ docker image tag alpine:3.12 myimage:1.0

Display image detailed information

$ docker image inspect alpine

Remove images

$ docker image rm alpine:3.12
$ docker rmi myimage:1.0

Remove unused images

$ docker image prune [-f|-a]

Push images to Docker Hub registry

You need to login to the registry before issuing this command.

$ docker image push myimage:latest

Build images from Dockerfile

$ docker image build .
$ docker image build -t myimage:2.0 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment