Docker container connection to gateway refused - php

While setting up a php dev environment with docker, I ran into an issue while setting up remote debugging (XDEBUG) through a dbgp proxy.
Connecting my host machine to the proxy doesn't seem to be a problem, but the proxy container cannot reach my host machine over the port that is configured (in this case 9003)
I'm using docker compose on windows.
Sucessfully connecting my dev machine to the proxy:
INFO: dbgp.proxy: Server:onConnect ('172.18.0.1', 36558) [proxyinit -p 9003 -k XDEBUG_IDEA -m 1 ]
When executing a request containing the right IDE key (e.g. http://localhost/?XDEBUG_SESSION_START=XDEBUG_IDEA), the proxy reacts correctly but is unable to contact the gateway over the port that was registered by my dev machine)
INFO: dbgp.proxy: connection from 172.18.0.2:40902 [<__main__.sessionProxy instance at 0x7fcff1998998>]
ERROR: dbgp.proxy: Unable to connect to the server listener 172.18.0.1:9003 [<__main__.sessionProxy instance at 0x7fcff1998998>]
Traceback (most recent call last):
File "/usr/local/bin/pydbgpproxy", line 223, in startServer
self._server.connect((self._serverAddr[0], self._serverAddr[1]))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
WARNING: dbgp.proxy: Unable to connect to server with key [XDEBUG_IDEA], stopping request [<__main__.sessionProxy instance at 0x7fcff1998998>]
INFO: dbgp.proxy: session stopped
Any ideas on what is going wrong here?
Firewall issues can be excluded here, since i basically just turned it of.
I did log into the dbgpproxy container and was able to send requests to the gateway ip over ports 80 an 8080, but got the same connection refused when trying port 9003)
Any pointers would be greatly appreciated!
The docker compose file:
version: '2'
volumes:
mysqldata:
driver: local
services:
app:
restart: "always"
image: php:7.0-fpm
command: "true"
volumes:
- .:/var/www/html
nginx:
restart: "always"
build: ./docker/nginx/
ports:
- "80:80"
depends_on:
- php
php:
restart: "always"
build: ./docker/php/
environment:
XDEBUG_CONFIG: remote_host=dbgpproxy
expose:
- "9000"
depends_on:
- mysql
volumes_from:
- app
composer:
restart: "no"
image: composer/composer:php7
command: install
volumes:
- .:/app
dbgpproxy:
restart: "always"
image: christianbladescb/dbgpproxy
expose:
- "9000"
ports:
- "9001:9001"
environment:
DOCKER_HOST: 10.0.75.1
mysql:
image: mysql:latest
volumes:
- mysqldata:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8080:80
depends_on:
- mysql
environment:
PMA_HOST: mysql
redis:
image: redis
ports:
- "6379:6379"
mailcatcher:
image: schickling/mailcatcher
restart: "always"
Docker network info:
[
{
"Name": "test_default",
"Id": "8f5b2e1188d65948d6a46977467b181e7fdb4b112a688ff87691b35c29da8970",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Containers": {
"05725540eca07666de250f2bb9ae856da69c0c325c4476150f214ba32a9b8714": {
"Name": "test_nginx_1",
"EndpointID": "723a820ea07e77cf976712293a911be3245e862477af6e0ecdcc1462536de6f5",
"MacAddress": "02:42:ac:12:00:08",
"IPv4Address": "172.18.0.8/16",
"IPv6Address": ""
},
"78085ebed911e767a9c006d909cb245e0392055d37550c6cfa3a618969bef821": {
"Name": "test_dbgpproxy_1",
"EndpointID": "2332e1a01a8c0ec7262d96829d7d8f3cb4c711b6e9033ab85a8dfdb57ae01382",
"MacAddress": "02:42:ac:12:00:0a",
"IPv4Address": "172.18.0.10/16",
"IPv6Address": ""
},
"7e12ea0a3a9b90360be6c15222fd052fbf02065aa18b8a3b12d19779bef4b41b": {
"Name": "test_phpmyadmin_1",
"EndpointID": "456a6508b6a507e01584beaf54eec9605db449261749065a562a6fb62111bb9c",
"MacAddress": "02:42:ac:12:00:05",
"IPv4Address": "172.18.0.5/16",
"IPv6Address": ""
},
"81043a642cd9932e16bc51ba4604f6057d82e2c05f6e7378a85adfaa2de87f28": {
"Name": "test_app_1",
"EndpointID": "cfa41a5f210d4907747dcf7d516c6bdaecb817c993867a1e5f8e0250d33c927b",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""
},
"8b0cd7dc33fb783ae811f7ba15decd0165199da66242a10a33d8ee86c41bd664": {
"Name": "test_mailcatcher_1",
"EndpointID": "f2ed38e42dffd9565822a7ac248dcb022a47c8a78b05e93793b62d7188d0823c",
"MacAddress": "02:42:ac:12:00:06",
"IPv4Address": "172.18.0.6/16",
"IPv6Address": ""
},
"d552bf1ab3914220b8fbf9961cc3801acbe180c6e945bd0b4c3bcf8588352a5d": {
"Name": "test_mysql_1",
"EndpointID": "6188cbeb49cf8afc2a7622bd6ef7fc7076ea91b909ec3efc1d9a1ed1d35d5790",
"MacAddress": "02:42:ac:12:00:04",
"IPv4Address": "172.18.0.4/16",
"IPv6Address": ""
},
"ecc941fc337d727e3c118bf9112dee1552ef5db7c94b24706c7d03bc42ea6c0a": {
"Name": "test_redis_1",
"EndpointID": "3f4254982ed1be8354f514dd717993e02b4afdfad8d022f5f8daf0b919a852e1",
"MacAddress": "02:42:ac:12:00:07",
"IPv4Address": "172.18.0.7/16",
"IPv6Address": ""
},
"f15f53405205db7263013fbb1ef1272764ca16850a46097b23d3619cd3d37b20": {
"Name": "test_php_1",
"EndpointID": "5fe30610823cd5660bf62e7612007ff4eef0316cbdfd15dbc0e56cafa6a3aca7",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]

That's because pydbgpproxy works similar to XDebug and it is trying to connect to the wrong IP address. The correct IP address pydbgpproxy should connect to is host.docker.internal.
Situation:
xDebug ---> pydbgpproxy -X-> Host
This is because pydbgpproxy received the wrong IP from Docker in the first place.
So I guess you have to hardcode the host.docker.internal IP into pydbgpproxy

Related

Debug Yii 1.1 using VSCode and Docker

I want to ask about debugging Yii 1.1 applications. I've tried implementing the answers on StackOverflow and other websites, but my VSCode still can't debug the application, the breakpoints that have been set are never read at all. I am using Docker to run Yii.
Here are the details of the file I used.
docker-compose.yml
version: '3'
services:
web:
container_name: php72
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:80"
volumes:
- ./:/var/www/html
- ./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
networks:
- app-network
mysql:
image: mysql:8.0.31-oracle
restart: always
environment:
MYSQL_ROOT_PASSWORD: '123456'
MYSQL_USER: 'admin'
MYSQL_PASSWORD: '123456'
MYSQL_DATABASE: 'test_db'
volumes:
- db_data:/var/lib/mysql
ports:
- 3306:3306
networks:
- app-network
networks:
app-network:
volumes:
db_data:
Dockerfile
FROM php:7.2-apache
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions gd xdebug pdo pdo_mysql pdo_pgsql mongodb mbstring zip
EXPOSE 80
xdebug.ini
zend_extension=xdebug
[xdebug]
xdebug.mode=debug
xdebug.discover_client_host=1
xdebug.idekey=VSCODE
xdebug.start_with_request=yes
xdebug.client_port=9003
xdebug.remote_host="host.docker.internal"
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:8001"
],
"program": "",
"cwd": "${workspaceRoot}/../../",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}
And here is my project structure:
I access my apps in a browser with localhost:8000, then I try to turn on the VSCode debugger, but this is the result:
Any help is very much appreciated.
Is there any missing configuration?
After watching several videos on how to setup Xdebug for an application running inside a docker container, I finally found the answer that works for my case.
I changed my docker-compose.yml to be like this:
version: '3'
services:
web:
container_name: php72
build:
context: .
dockerfile: Dockerfile
extra_hosts:
- "host.docker.internal:host-gateway" // Add extra host for docker
ports:
- "8000:80"
volumes:
- ./:/var/www/html // this is the remote path where my apps installed
- ./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
networks:
- app-network
mysql:
image: mysql:8.0.31-oracle
restart: always
environment:
MYSQL_ROOT_PASSWORD: '123456'
MYSQL_USER: 'admin'
MYSQL_PASSWORD: '123456'
MYSQL_DATABASE: 'wms_test'
volumes:
- db_data:/var/lib/mysql
ports:
- 3306:3306
networks:
- app-network
networks:
app-network:
volumes:
db_data:
And as per as #LazyOne advise, since I am using Xdebug 3 I have change my xdebug.ini also to be like this:
zend_extension=xdebug
[xdebug]
xdebug.mode=develop,debug
xdebug.start_with_request=yes
xdebug.client_port=9003
xdebug.client_host=host.docker.internal
xdebug.idekey="VSCODE"
xdebug.log=/tmp/xdebug_remote.log
And the important part, after watching this YouTube video Setup Xdebug WITH DOCKER and debug in VSCode I've figured out what is missing in my previous setup, and that is the pathMapping. So I've changed my launch.json to be like this:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html" : "${workspaceFolder}"
}
}
]
}
And voila that work like a charm:

Laravel Sail - Migration are working but can't register new user

I've set up a new laravel project and here's the step I followed :
install laravel on docker using
curl -s "https://laravel.build/example-app" | bash
changing mysql port as 3306 is already used in my machine. Files have changed
.env file
DB_CONNECTION=mysql
DB_HOST=0.0.0.0
DB_PORT=4306
DB_DATABASE=example_app
DB_USERNAME=sail
DB_PASSWORD=password
docker-compose file (mysql container section)
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-4306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
retries: 3
timeout: 5s
build and run container
./vendor/bin/sail up
run 1st migration
Everything works fine at this point.
Then I install breeze package and run the migration
composer require laravel/breeze && php artisan migrate
Everything is still working at this point.
Then when I try to register a new user entering the adress localhost/register, I get the following error
lluminate \ Database \ QueryException
SQLSTATE[HY000] [2002] Connection refused
select count(*) as aggregate from `users` where `email` = my_new_user#test.com
Am I missing something in the .env or the docker-compose.yml ?
Thanks a lot
I found a fix by changing the environment variable with the Gateway IP
Use this command to find this IP
docker network inspect bridge
you should have a result like the following :
[
{
"Name": "bridge",
"Id": "17da7215587ae714f631d213fed173550b69d38a5824c1998e1c3cd4b2e954b",
"Created": "2022-10-26T19:26:38.585884296Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
use the Gateway entry in your .env file

How to configure Docker wpdiaries/wordpress-xdebug:latest with VS Code PHP Debug?

I want to configure VS Code Xdebug plugin to work with Xdebug inside a WordPress Docker container.
I have an issue with the ports.
If I specify on the WP-with-Xdebug container in the "ports" section of the docker-compose.yml file:
- "9009:9000"
And in the environment variable XDEBUG_CONFIG on the same container:
XDEBUG_CONFIG: remote_host=172.17.0.1 mode=debug start_with_request=true client_port=9000
Then in the launch.json file of the VS Code plugin config I put this line:
"port": 9009
Then, when I run docker-compose down and then docker-compose up, I see that the docker-compose up log is good, no errors are in it. Then I click on the green Play icon before the option "Listen for Xdebug" I get the message box with:
listen EADDRINUSE: address already in use :::9009
I think that both the WP container with Xdebug in it and the VS Code plugin want to use the same port on the host 9009 to do the same think, send information to one another, but I do not understand why they do not succeed.
I did not put here the output of phpinfo() because it contains sensible information.
I use:
https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug
https://github.com/xdebug/vscode-php-debug
wpdiaries/wordpress-xdebug:latest Docker image (https://hub.docker.com/r/wpdiaries/wordpress-xdebug or https://github.com/wpdiaries/wordpress-xdebug)
Xdebug v3
latest stable version of WordPress and PHP v8.0.3
I did not try a lot but a little of this: https://github.com/mac-cain13/xdebug-helper-for-chrome and I don't think it helps me in this issue.
This is a filtered version of my docker-compose.yml:
version: '3.3'
services:
db:
container_name: "db_1"
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: "no"
environment:
MYSQL_DATABASE: "wordpress"
MYSQL_USER: "root"
MYSQL_ROOT_PASSWORD: "9821379"
wordpress:
container_name: "wordpress_1"
depends_on:
- db
image: wpdiaries/wordpress-xdebug:latest
ports:
- "80:80"
- "9009:9000"
volumes:
- type: bind
source: ./html
target: /var/www/html
volume:
nocopy: true
restart: "no"
environment:
WORDPRESS_DB_NAME: "wordpress"
WORDPRESS_DB_USER: "root"
WORDPRESS_DB_PASSWORD: "9821379"
WORDPRESS_DB_HOST: db:3306
WORDPRESS_TABLE_PREFIX: 'wp_'
XDEBUG_CONFIG: remote_host=172.17.0.1 mode=debug start_with_request=true client_port=9000
phpmyadmin:
container_name: "phpmyadmin_1"
depends_on:
- db
restart: "no"
ports:
- "8080:80"
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: db:3306
PMA_USER: "root"
PMA_PORT: 3306
PMA_PASSWORD: "9821379"
volumes:
db_data: {}
This is my launch.json file:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9009,
"pathMappings": {
"/var/www/html": "${workspaceFolder}/html"
}
},
// the following is not used and not updated:
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003
}
]
}
Articles I've tried more or less:
https://dev.to/natterstefan/docker-tip-how-to-get-host-s-ip-address-inside-a-docker-container-5anh
https://dzone.com/articles/setup-wordpress-debug-environment-with-docker-and
https://www.wpdiaries.com/wordpress-with-xdebug-for-docker/#using-a-ready-made-image
I've rebooted my laptop and the same issue appears again.
Until I get a reaction to this post I think I will read the docs here: https://xdebug.org/docs/step_debug.
I think that both the WP container with Xdebug in it and the VS Code plugin want to use the same port on the host 9009
Yes, that nails it on the head. It is Xdebug that makes the connection, so there is no reason to expose the 9000/9009 port on the WordPress containers as that is for incoming connections. You can remove that expose line.

PHP application can't connect to MariaDB using Docker Compose

My application is set up using Docker Compose. My docker-compose.yml contents;
version: "3.1"
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
db:
image: mariadb:10.4
restart: always
ports:
- "3307:3306"
volumes:
- ./mysql:/var/lib/mysql
container_name: mariadb
environment:
- MYSQL_DATABASE=dbname
- MYSQL_PASSWORD=dbpass
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_USER=dbuser
phpapp:
depends_on:
- nginx-proxy
- db
image: myhub/myrepo
restart: always
container_name: phpapp
expose:
- 80
- 443
environment:
- APP_ENV=prod
- APP_SECRET="secret"
- CORS_ALLOW_ORIGIN="^.*?$$"
- DATABASE_URL="mysql://dbuser:dbpass#db/dbname"
- VIRTUAL_HOST=phpapp.com
networks:
default:
external:
name: nginx-proxy
However, when I try to connect to the database in the application I get an error message; SQLSTATE[HY000] [2002] No such file or directory.
I can, however, connect on port 3307 on my localhost with the correct username and password. Also, when I access the container using docker exec -ti phpapp /bin/bash and run env I get all the environment variables listed and they are correct.
When I execute docker network inspect nginx-proxy I get;
[
{
"Name": "nginx-proxy",
"Id": "2529933d7e38cfba34e0e876e43a96fc4c8d7321c1e89048319ba804b00e1026",
"Created": "2018-12-12T05:04:01.9044879Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {}
}
]
The containers array is empty, however a default (external) network is set in the docker-compose.yml.
Welcome to stackoverflow :)
I think maybe it is not working for db container not linked from phpapp container. Can you try like this?
version: "3.1"
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
db:
image: mariadb:10.4
restart: always
ports:
- "3307:3306"
volumes:
- ./mysql:/var/lib/mysql
container_name: mariadb
environment:
- MYSQL_DATABASE=dbname
- MYSQL_PASSWORD=dbpass
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_USER=dbuser
phpapp:
depends_on:
- nginx-proxy
links:
- db
image: myhub/myrepo
restart: always
container_name: phpapp
expose:
- 80
- 443
environment:
- APP_ENV=prod
- APP_SECRET="secret"
- CORS_ALLOW_ORIGIN="^.*?$$"
- DATABASE_URL="mysql://dbuser:dbpass#db/dbname"
- VIRTUAL_HOST=phpapp.com
networks:
default:
external:
name: nginx-proxy
I moved db from depends_on to links. You must use db for hostname in database connection now.
I hope i could help.
Well, I've found the solution to this problem. However, it's not the one I expected. The database URL is defined as:
DATABASE_URL="mysql://dbuser:dbpass#db/dbname"
It should be without quotes, like this:
DATABASE_URL=mysql://dbuser:dbpass#db/dbname
Now everything seems to work, does anyone know when and why you can and can't use quotes?

ECS mount volume to nginx container

I am trying to set up ECS in order to run my php/nginx docker application.
It works locally using this docker-compose.yml file:
version: '2'
services:
nginx:
image: NGINX-IMAGE
ports:
- 80:80
links:
- php
volumes_from:
- php
environment:
APP_SERVER_NAME: <ip>
php:
image: PHP-IMAGE
ports:
- 9000:9000
volumes:
- /var/www/html
The problem is that I can't get this working using ECS.
I don't know how to create the web-data volume and let nginx grap it using volumes_from.
I am trying to create the volume using this JSON:
volumes='[
{
"name": "webdata",
"host": {
"sourcePath": "/var/www/html"
}
}
]'
And then in my container-definitions to the php-container I add:
"mountPoints":
[
{
"sourceVolume": "webdata",
"containerPath": "/var/www/html",
"readOnly": false
}
]
However, when I do this, it adds the content from the host's /var/www/html folder to the /var/www/html folder of the containers.
My question is, how do I configure the volume to use the data from the php's /var/www/html container and let nginx access this data?
I managed to find a solution that suited the setup for ECS.
I simply created a VOLUME in my php Dockerfile referencing /var/www/html.
This means I longer need to reference the volume in the volumes section of the php container. And nginx will still be able to access the volume with volumes_from.
Update
This is my working task definition for ECS:
task_template='[
{
"name": "nginx",
"image": "NGINX_IMAGE",
"essential": true,
"cpu": 10,
"memoryReservation": 1000,
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"environment" : [
{ "name" : "APP_SERVER_NAME", "value" : "%s" }
],
"links": [
"app"
],
"volumesFrom": [
{ "sourceContainer": "app" }
]
},
{
"name": "app",
"image": "IMAGE",
"essential": true,
"cpu": 10,
"memoryReservation": 1000,
"portMappings": [
{
"containerPort": 9000,
"hostPort": 9000
}
]
}
]'
And then I added VOLUME ["/var/www/html"] to my app Dockerfile. Now nginx can access the data with the volumes_from argument in the task definition.

Categories