Skip to content
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 returning service needs to be built issue #1719

Closed
VinceBarresi opened this issue Jul 17, 2015 · 22 comments
Closed

docker-compose up returning service needs to be built issue #1719

VinceBarresi opened this issue Jul 17, 2015 · 22 comments

Comments

@VinceBarresi
Copy link

I'm trying to compose a multi container web application by running the command docker-compose up -d. I keep seeing the following error:

docker-compose up -d
Recreating 99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_cscdadockerfiles_memcached_1...
Service 'memcached' needs to be built, but --no-build was passed.

I'm unsure how to resolve this issue as nothing that I've tried seems to work. Here is my docker-compose.yml file:

memcached:
  build: ../cs_cda_dockerFiles/memcached
  ports:
    - "11211:11211"

postgres:
  image: postgres:9.3
  environment:
    POSTGRES_USER: "#####"
    POSTGRES_PASSWORD: "#####"
    POSTGRES_DB: "#####"
  volumes:
    - "../dockerFiles/db_dump/data.sql:/temp/data.sql"

curriculumservices:
  build: ../cs_cda_dockerFiles/curriculum_services
  links: 
    - memcached
  ports:
    - "8080:8080"

web:
  build: ../cs_cda_dockerFiles/web
  links: 
    - curriculumservices
  ports:
    - "8090:8080"

On running docker-compose up --no-recreate, I get the following output:

Starting 99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_99894449ed_cscdadockerfiles_memcached_1...
Cannot start container 99894449ed0229c6a2d4d0358162f145899f31bfc609abb7bb14b6d9eb0ed820: Error getting container 99894449ed0229c6a2d4d0358162f145899f31bfc609abb7bb14b6d9eb0ed820 from driver aufs: error creating aufs mount to /mnt/sda1/var/lib/docker/aufs/mnt/99894449ed0229c6a2d4d0358162f145899f31bfc609abb7bb14b6d9eb0ed820: invalid argument

@dnephin
Copy link

dnephin commented Jul 17, 2015

It seems like there are a few things going on here.

The container naming problem was fixed by #1642 and will be in 1.4.0.

Service 'memcached' needs to be built, but --no-build was passed.

I don't see --no-build in your command line was it part of the command that caused that error?

The aufs driver issue may have been caused by one of the earlier problems.

I would start by removing any old containers that match cscdadockerfiles and try docker-compose up -d again.

@VinceBarresi
Copy link
Author

I did not have --no-build as a part of the command and also there are no old containers. I tried using --no-build now and got the exact same error.
The commands docker images and docker ps tell me there are no instances at all.

@dnephin
Copy link

dnephin commented Jul 17, 2015

docker ps -a | grep cscdadockerfiles should show at least that one container from the error output.

Which version of docker-compose are you using?

@VinceBarresi
Copy link
Author

This is the screenshot of that command

screen shot 2015-07-17 at 3 34 42 pm

Also, when I try to remove the above images, the output is: Error response from daemon: No such image.
I am on v1.3.2

@thaJeztah
Copy link
Member

Wondering if there's a length restriction to container-names? that container-name is 314 chars long

@dnephin
Copy link

dnephin commented Jul 17, 2015

docker ps -a | grep cscdadockerfiles | awk '{print $1}' | xargs docker rm should remove those 4 containers, and get it working again.

@VinceBarresi
Copy link
Author

Thanks for that command. That worked! I didn't know about the -a flag so I didn't see those containers. I just ran docker ps and didn't see anything. Thanks again.

@dnephin
Copy link

dnephin commented Jul 17, 2015

Great! I'm still not sure about the original cause of the --no-build error. I'll leave this open for now to see if anyone else hits that problem.

@VinceBarresi
Copy link
Author

Ok cool. If I see that again, I'll try and reproduce it and give you guys more info.

@SaiOngole
Copy link

I am facing the same issue. I run docker-compose up -d and it tells me that service needs to be built but --no-build was passed.
screen shot 2015-07-21 at 2 14 08 pm

@dirkk
Copy link

dirkk commented Jul 24, 2015

I can confirm, I had the same problem. Removing all docker containers fixed the issue, but there seems to be something going on to initially cause the issue.

@reharik
Copy link

reharik commented Jul 29, 2015

For what it's worth, I am/was having same problem. I was doing

docker rmi -f myImage  

when I had a container built on that image. It successfully deletes the image but the container is still there. so if I do

docker rm xxx

then the containers gone, the image is gone, and the docker-compose up works
R

@aanand
Copy link

aanand commented Jul 29, 2015

Right, I see - if you remove a service's image but leave the containers around, docker-compose up will see there are existing containers and skip the build step (this seems to have been the case ever since --no-build was introduced). Then it'll fail because the image doesn't exist.

Perhaps we shouldn't be skipping the build step when recreating.

@cbonami
Copy link

cbonami commented Aug 14, 2015

Same problem here.

@bsao
Copy link

bsao commented Aug 20, 2015

Same problem! I removed all images, and stopped all containes!

When i run docker-compose i got same error!

@dnephin
Copy link

dnephin commented Aug 31, 2015

As long as you don't rmi -f the image, docker is going to refuse to remove images that are being used (rmi without -f is fine). It's probably a bad idea to be removing images where you still have containers using them.

If you really want to force clean everything, removing all containers (not just stopping them) would be a good idea, and would also prevent this issue.

May I ask why you're force removing all images?

@aanand
Copy link

aanand commented Sep 3, 2015

@asheshambasta I don't understand - that's not a docker-compose command. Did you comment on the right issue?

@asheshambasta
Copy link

@aanand thanks for pointing that out, removing it from here. It was indeed the wrong issue.

@simonfl3tcher
Copy link

I can confirm that I have also had this error. Removing all the images and containers seemed to work for me.

@martinheidegger
Copy link

Same here:

Compose version 1.4.0
Docker base_url: https://192.168.99.100:2376
Docker version: KernelVersion=4.0.9-boot2docker, Os=linux, BuildTime=Thu Aug 13 02:49:29 UTC 2015, ApiVersion=1.20, Version=1.8.1, GitCommit=d12ea79, Arch=amd64, GoVersion=go1.4.2
docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=src', u'com.docker.compose.service=mysql', u'com.docker.compose.oneoff=False']})
docker containers -> (list with 1 items)
docker inspect_container <- (u'f3812c423ba9d7efb224d7803951454e8de04b094de9fd4a2a9fd7087475ecb3')
docker inspect_container -> {u'AppArmorProfile': u'',
 u'Args': [u'mysqld'],
 u'Config': {u'AttachStderr': False,
             u'AttachStdin': False,
             u'AttachStdout': False,
             u'Cmd': [u'mysqld'],
             u'CpuShares': 0,
             u'Cpuset': u'',
             u'Domainname': u'',
             u'Entrypoint': [u'/docker-entrypoint.sh'],
...
docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=src', u'com.docker.compose.service=web', u'com.docker.compose.oneoff=False']})
docker containers -> (list with 1 items)
docker inspect_container <- (u'f9a91c4f389f9cb1cbcfa26ab88dadcf4fdda1d268f934243ab3343ead405e4d')
docker inspect_container -> {u'AppArmorProfile': u'',
 u'Args': [],
 u'Config': {u'AttachStderr': False,
             u'AttachStdin': False,
             u'AttachStdout': False,
             u'Cmd': [u'apache2-foreground'],
             u'CpuShares': 0,
             u'Cpuset': u'',
             u'Domainname': u'',
             u'Entrypoint': None,
...
docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=src', u'com.docker.compose.service=mysql', u'com.docker.compose.oneoff=False']})
docker containers -> (list with 1 items)
docker inspect_image <- (u'src_mysql')
docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=src', u'com.docker.compose.service=web', u'com.docker.compose.oneoff=False']})
docker containers -> (list with 1 items)
Recreating f3812c423b_f3812c423b_f3812c423b_src_mysql_1...
docker stop <- (u'f3812c423ba9d7efb224d7803951454e8de04b094de9fd4a2a9fd7087475ecb3', timeout=10)
docker stop -> None
docker rename <- (u'f3812c423ba9d7efb224d7803951454e8de04b094de9fd4a2a9fd7087475ecb3', u'f3812c423b_f3812c423b_f3812c423b_f3812c423b_src_mysql_1')
docker rename -> None
docker inspect_container <- (u'f3812c423ba9d7efb224d7803951454e8de04b094de9fd4a2a9fd7087475ecb3')
docker inspect_container -> {u'AppArmorProfile': u'',
 u'Args': [u'mysqld'],
 u'Config': {u'AttachStderr': False,
             u'AttachStdin': False,
             u'AttachStdout': False,
             u'Cmd': [u'mysqld'],
             u'CpuShares': 0,
             u'Cpuset': u'',
             u'Domainname': u'',
             u'Entrypoint': [u'/docker-entrypoint.sh'],
...
docker inspect_image <- (u'src_mysql')
Service 'mysql' needs to be built, but --no-build was passed.

@bahrmichael
Copy link

+1
fixed it by stopping all containers and running docker rm $(docker ps -a -q)

@dnephin
Copy link

dnephin commented Nov 3, 2015

I think this issue is now a duplicate of #1679.

Closing as duplicate. If you feel it is different in some way, please comment.

@dnephin dnephin closed this as completed Nov 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests