Skip to content

Instantly share code, notes, and snippets.

@cornernote
Last active Sep 27, 2020
Embed
What would you like to do?
Play with Docker PHP

Play with Docker

There are many way to try out Docker PHP, a really slick one is creating a stack on Play with Docker.

Login or signup, then create a new instance.

Download a Docker PHP application definition:

curl -Lo docker-compose.yml https://gist.githubusercontent.com/cornernote/f3b6c62e76500afd26454e15c6d18d7e/raw/16a2e76e95976aa34bcf3d29c3ffeb57a03a3cbf/docker-compose.yml

And start the stack

docker-compose up -d

Your services will be available on their mapped port, just click the label right next to the node IP address.

Troubleshooting

Missing Port Link

If the link to the exposed port does not show then you can determine it from the SSH link provided. Simply convert the link as follows then visit the page.

Change:

ssh EXAMPLE@direct.labs.play-with-docker.com

To:

http://EXAMPLE-80.direct.labs.play-with-docker.com

Nginx Bad Gateway

If nginx complains about a bad gateway, you may just need to wait about 60 seconds for everything to start up.

It may also be you have an invalid configuration file. See logs below.

Viewing Logs

When all else fails, check the logs.

Container logs:

docker-compose logs -f shinken
version: '3'
services:
php:
image: cornernote/php:7.3.22-fpm-stretch
environment:
- USE_SSL=0
- DH_SIZE=2048
- CERTBOT_EMAIL=
- CERTBOT_DOMAIN=
- NGINX_ERROR_LOG_LEVEL=warn
- SERVER_NAME=app
- FASTCGI_PASS_HOST=127.0.0.1:9000
#volumes:
#- ./web:/app/web
#- ./src:/app/src
ports:
- 80:80
#- 443:443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment