How to Deploy Containerized WordPress using Repository in Ubuntu Server

After successfully installing WordPress in a docker container and pushing it in github repository, you can use it in other ubuntu server by following the steps

Step 1: Clone Repository using git clone command

Go to directory /var/www/html then paste the repository link. Her, I used a private repository and copy pasted it together with git clone command.

$ cd /var/www/html
$ git clone

Step 2: Change credentials

Go to project directory then open docker-compose.yml file and change the following credentials for your own use.

$ cd wordpress-dockered
$ sudo nano docker-compose.yml

Then you will see the following inside the file then change its credentials. You can also change the port if it is already in use or leave it as it is.

version: "3"
  #MySQL Database image
    image: mysql
    restart: always
      MYSQL_ROOT_PASSWORD: my_password_1234789
      MYSQL_DATABASE: my_wp_database
      MYSQL_USER: my_wp_user
      MYSQL_PASSWORD: my_wp_user_password
      - mysql:/var/lib/mysql

  #WordPress image based on Apache
      - my_database
    image: wordpress:latest
    restart: always
      - "8000:80"
      WORDPRESS_DB_HOST: my_database:3306
      WORDPRESS_DB_USER: my_wp_user
      WORDPRESS_DB_PASSWORD: my_wp_user_password
      WORDPRESS_DB_NAME: my_wp_database
  mysql: {}

Press CTRL X + Y then hit ENTER to save changes.

Step 3: Run Docker Container

After applying changes to docker-compose.yml file, run docker by typing the command:

$ docker-compose up -d

Once it is running, you can now navigate to your browser and go to localhost:8000


If it shows the WordPress installation site, you successfully deployed it.

Leave a Comment

Your email address will not be published. Required fields are marked *