You are here
Home > 2018 > November

Containerize WordPress Using Docker

For Single Site without Proxy: docker-compose.yml version: '3.3' services: web: image: wordpress restart: always depends_on: - mysql links: - mysql expose: - 80 ports: - 80:80 environment: - WORDPRESS_DB_NAME=db_name - WORDPRESS_TABLE_PREFIX=wp_ - WORDPRESS_DB_HOST=mysql - WORDPRESS_DB_PASSWORD=db_wordpress_user_password - WORDPRESS_DB_USER=db_wordpress_user - VIRTUAL_HOST=x.example.com volumes: - ./html:/var/www/html networks: - wordpress-network mysql: image: mysql command: --default-authentication-plugin=mysql_native_password container_name: mysql restart: always volumes: - ./mysql:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=mysql_root_password - MYSQL_USER=db_wordpress_user - MYSQL_PASSWORD=db_wordpress_user_password - MYSQL_DATABASE=db_name - MYSQL_ROOT_HOST=% networks: - wordpress-network networks: wordpress-network:   For Single Site with Proxy: docker-compose.yml version: '3.3' services: web: image: wordpress restart: always depends_on: - mysql links: - mysql expose: - 80 environment: - WORDPRESS_DB_NAME=db_name - WORDPRESS_TABLE_PREFIX=wp_ - WORDPRESS_DB_HOST=mysql - WORDPRESS_DB_PASSWORD=db_wordpress_user_password - WORDPRESS_DB_USER=db_wordpress_user - VIRTUAL_HOST=x.example.com - LETSENCRYPT_EMAIL=x@example.com - LETSENCRYPT_HOST=x.example.com volumes: - ./html:/var/www/html networks: -

Installing Docker and Docker-Compose on Ubuntu

Docker apt-get update apt-get install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - apt-key fingerprint 0EBFCD88 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt-get update apt-get install docker-ce docker -v docker-compose curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose --version

Top