-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker-compose up doesn't rebuild image although Dockerfile has changed #1487
Comments
Hey @dnephin, what a small world! I'm running into an issue where Based on what I've read elsewhere (e.g. #1195), it seems like ╭─wting@nuc ~/code/reddit-mobile ‹python-2.7.12› ‹wting_chan-159_add_varnish_to_2X×ad20b6d›
╰─➤ docker ps 2016.09.15 12:20:46 PDT
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
╭─wting@nuc ~/code/reddit-mobile ‹python-2.7.12› ‹wting_chan-159_add_varnish_to_2X×ad20b6d›
╰─➤ docker-compose --version 2016.09.15 12:20:48 PDT
docker-compose version 1.8.0, build f3628c7
╭─wting@nuc ~/code/reddit-mobile ‹python-2.7.12› ‹wting_chan-159_add_varnish_to_2X×ad20b6d›
╰─➤ docker --version 2016.09.15 12:20:51 PDT
Docker version 1.12.1, build 23cf638
╭─wting@nuc ~/code/reddit-mobile ‹python-2.7.12› ‹wting_chan-159_add_varnish_to_2X×ad20b6d›
╰─➤ docker-compose build && docker-compose up 2 ↵ 2016.09.15 12:23:35 PDT
Building web
Step 1 : FROM reddit/reddit-nodejs:latest
---> ee57c186eb35
Step 2 : VOLUME /src
---> Using cache
---> 3720601d98c8
Step 3 : WORKDIR /src
---> Using cache
---> d4b9b360ef4e
Step 4 : EXPOSE 4444
---> Using cache
---> 5e232be73781
Step 5 : ENTRYPOINT npm start
---> Using cache
---> 1094fc9857bb
Successfully built 1094fc9857bb
Building varnish
Step 1 : FROM quay.io/reddit/varnish-fastly
# Executing 1 build trigger...
Step 1 : COPY default.vcl /etc/varnish/default.vcl
---> Using cache
---> ac9dadb35674
Step 2 : ENV VARNISH_PORTS 8080
---> Using cache
---> 3c43e0226f5f
Step 3 : EXPOSE 8080
---> Using cache
---> c88093c2ff32
Successfully built c88093c2ff32
Starting redditmobile_web_1
Starting redditmobile_varnish_1
Attaching to redditmobile_web_1, redditmobile_varnish_1
varnish_1 | storage_malloc: max size 100 MB.
varnish_1 | SHMFILE owned by running varnishd master (pid=1) # STALE LOCK FILE
varnish_1 | (Use unique -n arguments if you want multiple instances.)
web_1 |
web_1 | > r-project-blackbird@0.0.1 start /src
web_1 | > NODE_ENV=production npm run server
web_1 |
redditmobile_varnish_1 exited with code 2
web_1 |
web_1 | > r-project-blackbird@0.0.1 server /src
web_1 | > NODE_ENV=production node ./bin/ProductionServer.js
web_1 |
web_1 | Started cluster with 4 processes.
web_1 | Started server at PID 31
web_1 | Started server at PID 46
[..] |
hey @wting I think what might be happening is that the lock file is in a volume (https://docs.docker.com/compose/overview/#/preserve-volume-data-when-containers-are-created). You can try If it's not in a volume, I guess it could just be that the lock was never removed. Compose will try to start a container if it exists and the config hasn't changed, so running |
Thanks! version: '2'
services:
web:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "4444:4444"
volumes:
- .:/src
varnish:
build:
context: .
dockerfile: Dockerfile.varnish
ports:
- "4301:80"
depends_on:
- web For context:
|
Thanks wting, and all the ones who wrote on this issue, I've been "saved" by your comment => "docker-compose up --force-recreate (but not docker-compose --build)." |
|
FYI - had the same issue and the same fix as discussed. The interwebs led me here. Thanks for the good discussions! |
|
For clarify what is |
To rebuild a single image inside
e.g:
|
I was having similar challenges as of late because I switched from using...
To just...
But it never did rebuild so I was wondering if Looks like I was missing |
I expected --force-recreate to build the container, but it is not doing that. So I ended up using |
I had volume references and images from different projects and I was having this issue on a new project where the MsSql container was created but not the Dev-Env container itself. Was getting a 'There is no Dev-Env container found' msg. So just ran |
Very often, docker-compose up doesn't rebuild image specified as "build:" in the docker-compose.yml although the respective Dockerfile has changed. Instead, I need to run docker build -t servicename_foldername . manually for the affected service which will actually update the image accordingly.
Is this intended? Because it's rather annoying, I can never be sure the image is actually up-to-date and need to run docker build manually before using docker-compose up.
The text was updated successfully, but these errors were encountered: