Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: Nginx & PHP Container: no such file or directory

I want to play around with docker so I created my own 2 container, nginx and php. Both container are build successfully and are published on docker hub. After that I created a fig.yml in my projects folder. If I run fig up -d in my terminal, then I got the following error:

Recreating playground_php_1...
Cannot start container e087111c...: [8] System error: no such file or directory

Any ideas how I can fix this problem?

Here is my fig.yml:

web:
  image: mc388/docker-nginx:latest
  ports:
    - "80:80"
    - "443:443"
  links:
    - php
  volumes:
    - ./logs/nginx:/var/log/nginx
  volumes_from:
    - php
php:
  image: mc388/docker-php:latest
  volumes:
    - .:/var/www/

And here are the links to the config of both docker containers:

  • https://github.com/mc388/docker-nginx
  • https://github.com/mc388/docker-php
like image 505
Marvin Caspar Avatar asked Feb 11 '23 09:02

Marvin Caspar


1 Answers

The underlying php:fpm image has the following line in the Dockerfile:

WORKDIR /var/www/html

You then delete this directory, which breaks the default CMD command as it uses WORKDIR as its base.

I don't know much about PHP and this Docker image, but it's worth reading the documentation and looking at any examples you can find on how to use it; deleting a directory feels like you're working against the image.

like image 178
Adrian Mouat Avatar answered Feb 13 '23 03:02

Adrian Mouat