It seems like the simplest question I can't find the answer for.
- I build a docker image.
- run
docker images
shows that it's present. - I then add a new line to the Docker file.
- Then I rebuild the image.
- The old image is still in
docker images
and there's now a new image.
How does one simply update the old image without creating a new one?
My docker command: docker build -t nick_app . --force-rm --no-cache
(Note: I just tossed those --force-rm command and --no-cache command' because it seemed like it would work.)
Before:
Dockerfile:
FROM ruby:2.3.3
RUN apt-get update -qq && apt-get install -y
CMD ["echo", "Sup"]
docker images command:
REPOSITORY TAG IMAGE ID CREATED SIZE
nick_app latest 421662154c3f 9 minutes ago 746.9 MB
ruby 2.3.3 d00ebde6a601 2 days ago 730.1 MB
hello-world latest c54a2cc56cbb 4 months ago 1.848 kB
After: Dockerfile:
FROM ruby:2.3.3
RUN apt-get update -qq && apt-get install -y \
build-essential
CMD ["echo", "Sup"]
docker images command:
REPOSITORY TAG IMAGE ID CREATED SIZE
nick_app latest bcf9b3667202 3 seconds ago 746.9 MB
<none> <none> 421662154c3f 10 minutes ago 746.9 MB
ruby 2.3.3 d00ebde6a601 2 days ago 730.1 MB
hello-world latest c54a2cc56cbb 4 months ago 1.848 kB
Every dockerfile change I make creates a new none
image on rebuild. They're cumulative so every time I make a change and rebuild I get another none
image.
How does one get rid of that intermediate none
every time I make a dockerfile change?
docker build
directly (taking the command show in the answers).