How to pull a single image from any docker reposit

2019-03-12 07:47发布

The docker repositories contains multiple images. Is it possible to just pull the specific image from Repository.

When I use:

docker pull  ubuntu

It pulls down around 8-10 different versions of ubuntu.

标签: docker lxc
2条回答
做个烂人
2楼-- · 2019-03-12 08:30

You can also use

docker pull reponame:tagname
docker pull ubantu:quantal
查看更多
不美不萌又怎样
3楼-- · 2019-03-12 08:36

If there's a specific image that's tagged, you could use the --tag= (or -t) operator to pull the specific image you're looking for. There's a shorthand form for the command as well, which uses just a colon between the image name and the tag.

So if you want the version of ubuntu that's tagged as quantal, you could use:

docker pull ubuntu:quantal

The longer forms would be:

docker pull --tag="quantal" ubuntu
docker pull --t quantal ubuntu

This will still pull the historical layers used to build the final image, but will be a smaller subset than all of the layers for ubuntu.

[Updated to include Ben's note on shorthand from below. Thanks!]

查看更多
登录 后发表回答