Reputation: 58770
I have a docker container with this
nginx.conf
server {
listen 80;
index index.php index.html;
root /var/www/public;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
docker-compose.yaml
version: '2'
services:
# The Application
app:
build:
context: ./
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
environment:
- "DB_PORT=3306"
- "DB_HOST=database"
# The Web Server
web:
build:
context: ./
dockerfile: web.dockerfile
working_dir: /var/www
volumes_from:
- app
ports:
- 85:80
# The Database
database:
image: mysql:5.6
volumes:
- dbdata:/var/lib/mysql
environment:
- "MYSQL_DATABASE=homestead"
- "MYSQL_USER=homestead"
- "MYSQL_PASSWORD=secret"
- "MYSQL_ROOT_PASSWORD=secret"
ports:
- "33062:3306"
volumes:
dbdata:
The docker seems to build and start successfully
docker-compose up -d
docker_app_1 is up-to-date
docker_database_1 is up-to-date
Recreating docker_web_1 ...
Recreating docker_web_1 ... done
but I kept getting
File not found.
How would one go about debugging this?
Upvotes: 2
Views: 5430
Reputation: 355
All volumes and other directory settings ideally point to the same location. In your nginx.conf you have root /var/www/public; but in your yal you use /var/www. That might be you problem.
As for steps to proceed, you can check what directories your service actually uses by using the command the following command after you spin up your docker-compose.yml file :
docker-compose exec yourServiceName sh
replace yourServiceName with any service you have defined in your yaml. So app , web or database in your yaml above. And that command will take you into the shell (sh) of the container speicified. You can also replace sh with other commands to perform other actions with your container.
Upvotes: 2
Reputation: 68
start your container with docker exec -it xxxxxx bash
once you do that you will be inside the container. Now check your files if they are at the location you are putting them according to your docker-compose file.
Upvotes: 1