Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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>
like image 296
Jonathon Hill Avatar asked Jul 26 '16 09:07

Jonathon Hill


2 Answers

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.

like image 156
Céline Aussourd Avatar answered Oct 13 '22 02:10

Céline Aussourd


docker run --name <name>:0.2.34

This will run your built image

like image 42
TreantBG Avatar answered Oct 13 '22 00:10

TreantBG