Skip to content

Instantly share code, notes, and snippets.

@willianbs
Created August 26, 2019 17:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willianbs/bcdd3f52f21deb94fb9707e6790ca7c4 to your computer and use it in GitHub Desktop.
Save willianbs/bcdd3f52f21deb94fb9707e6790ca7c4 to your computer and use it in GitHub Desktop.
Simple Docker Apache+PHP local dev in the current dir
docker run -d -p 8082:80 --mount type=bind,source="$(pwd)",target=/var/www/html php:apache
// That's it! If you try this, and it works for you, you're done!
// The command does the following:
// If the Docker image php:apache is not present in your machine's local Docker registry, it will be downloaded from Docker hub.
// It creates a new container based on the image php:apache.
// It maps port 80 from the container to port 8082 on your host machine.
// It mounts the current directory from your host machine to /var/www/html in the container.
// If you're lucky, you can now access http://localhost:8082/ and see your web pages hosted from an Apache HTTP Server with PHP in a Docker container.
@willianbs
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment