Problem with docker command: container command not found

I had a problem trying to start multiple containers using docker-compose:

Dockerfile:

FROM nginx:1.9 ADD ./nginx-sites/default /etc/nginx/sites-available/default 

docker-compose.yml:

 version: "2" services: web: build: . ports: - "80:80" volumes: - ./src:/var/www links: - fpm fpm: image: php:7-fpm volumes: - ./src:/var/www 

When I use docker-compose up to run the application, I get the following error:

 ERROR: Container command not found or does not exist. 

I would like to help solve this problem.

+5
source share
1 answer

As mentioned in the comments on the original question, php: fpm image requires its volume to be set to /var/www/html .

If you want to use a different directory, you can get around this using your own Docker file (based on php: fpm). For this, a Dockerfile would be helpful:

 FROM php:fpm WORKDIR /var/www 

Setting the working drive to the correct directory seems to do the trick.

Then in your docker-compose.yml you will create a Docker using this file instead of directly using the php: fpm image.

 version: "2" services: # ... fpm: build: ./path/to/dockerfile volumes: - ./src:/var/www 
+12
source

Source: https://habr.com/ru/post/1242970/


All Articles