The misunderstood Docker tag: latest

FROM busybox:ubuntu-14.04RUN echo “#!/bin/sh\n” > /test.sh
RUN echo “echo \”this is version 1\”” >> /test.sh
ENTRYPOINT [“sh”, “/test.sh”]
sudo docker build -t marc/test .
$ sudo docker run marc/test
this is version 1
sudo docker tag marc/test marc/test:1
$ sudo docker push marc/test
The push refers to a repository [marc/test] (len: 2)
Sending image list
Pushing repository marc/test (2 tags)
511136ea3c5a: Image already pushed, skipping
... (truncated)
FROM busybox:ubuntu-14.04RUN echo “#!/bin/sh\n” > /test.sh
RUN echo “echo \”this is version 2\”” >> /test.sh
ENTRYPOINT [“sh”, “/test.sh”]
sudo docker build -t marc/test:2 .
sudo docker push marc/test
$ sudo docker run marc/test
this is version 1
$ sudo docker pull marc/test
Pulling repository marc/test
fdf416e5c66e: Download complete
511136ea3c5a: Download complete
df7546f9f060: Download complete
e8a999563c47: Download complete
f6169d24347d: Download complete
d3dbb7dd473f: Download complete
304a1af73537: Download complete
Status: Image is up to date for marc/test:latest
$ sudo docker run marc/test
this is version 1
$ sudo docker pull marc/test:latest
Pulling repository marc/test
fdf416e5c66e: Download complete
511136ea3c5a: Download complete
df7546f9f060: Download complete
e8a999563c47: Download complete
f6169d24347d: Download complete
d3dbb7dd473f: Download complete
304a1af73537: Download complete
Status: Image is up to date for marc/test:latest
$ sudo docker run marc/test
this is version 1

Latest is just a tag with a special name.

sudo docker build -t marc/test .
sudo docker tag marc/test marc/test:2
...
sudo docker build -t marc/test .
sudo docker tag marc/test:3
...

--

--

Founder, replicated.com. Previously founder of @lookioapp. Developer #golang, #erlang and more.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store