Created
September 14, 2018 01:00
-
-
Save darkn3rd/8946f17a736fd90455c7caafca891a78 to your computer and use it in GitHub Desktop.
Docker WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create the network if network does not exist | |
docker network list | grep -q "wordpress_net" || \ | |
docker network create "wordpress_net" | |
# create volumes | |
docker volume create -d local --name "db_data" | |
# start mysql database | |
docker run -d \ | |
-v db_data:/var/lib/mysql:rw \ | |
--network='wordpress_net' \ | |
--network-alias db \ | |
--restart=always \ | |
-e MYSQL_ROOT_PASSWORD='wordpress' \ | |
-e MYSQL_PASSWORD='wordpress' \ | |
-e MYSQL_USER='wordpress' \ | |
-e MYSQL_DATABASE='wordpress' \ | |
--name db mysql:5.7 | |
# start wordpress application | |
docker run -d \ | |
--network=wordpress_net \ | |
--network-alias wordpress \ | |
-p "8080:80" \ | |
--restart=always \ | |
-e WORDPRESS_DB_HOST="db:3306" \ | |
-e WORDPRESS_DB_PASSWORD='wordpress' \ | |
--name wordpress wordpress:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment