Jonathon Hill
Jonathon Hill

Reputation: 1057

docker-compose up -d <name>; No such service: <name>

I have built an image using my dockerfile with the following command:

docker build –t <name>:0.2.34 .

and then I have tried to use my docker-compose.yml:

strat:
  container_name: <name>
  image: <name>:0.2.34
  restart: always
  command: bash -lc 'blah'

to bring up my container:

docker-compose up -d <name>

Which gives me the following 'error':

No such service: <name>

Upvotes: 27

Views: 76812

Answers (2)

TreantBG
TreantBG

Reputation: 1222

docker run --name <name>:0.2.34

This will run your built image

Upvotes: 2

C&#233;line Aussourd
C&#233;line Aussourd

Reputation: 10664

You should run: docker-compose up -d strat

From the documentation:

Usage: up [options] [SERVICE...]

You need to specify your service name, not your image name.

Note: You can simply run docker-compose up -d to start all the services that are in your docker-compose file.

Upvotes: 33

Related Questions