white_gecko
white_gecko

Reputation: 5086

docker-compose tries to pull already existing images

I have a docker-compose.yml file, which defines a services and its image.

service:
    image: my_image

now, that I run docker-compose up I get the following message:

$ docker-compose up    
Pulling service (my_image:latest)...
Pulling repository docker.io/library/my_image
ERROR: Error: image library/my_image:latest not found

It is correct, that my_image in this case is not on the docker hub. But I've created it with docker build -t my_image . (in a different file) before and it is listed in docker images.

Is there anything I miss to tell docker-compose, to not look for the image in the docker.io registry/hub?

[edit] docker client and server version is 1.9.1, docker-compose version is 1.5.2.

I'm running docker-compose (as well as docker) through the HTTP-API on a remote machine, don't know if this makes any difference.

Upvotes: 8

Views: 3388

Answers (1)

Mathias Asberg
Mathias Asberg

Reputation: 3840

If you have image local or anywhere except docker hub you need to use build and path or url to Dockerfile. So basically when we work OFF dockerhub we change image to path !

ubuntu:
  container_name: ubuntu
  build: /compose/build/ubuntu
  links:
    - db:mysql
  ports:
    - 80:80

In this example am using my own Ubuntu Dockerfile that is places in the build path. The file should be named Dockerfile like normal and you just specify the path to folder where it is.

Upvotes: 1

Related Questions