SiteHost

Getting started

Many Cloud Containers will have a corresponding image in our Docker Hub for you to use locally.

To run images locally, you'll have to install Docker. We assume a working level of knowledge with Docker before using our public images. If this isn't something you're familiar with yet you can get started by reading the Docker Docs.

Quick start

Here we provide you with a Docker compose YAML file that you can use as a starting point for running your SiteHost containers locally.

To learn more about what Docker compose is and how to use it you can read more about it in the Docker Docs.

services:
  cceb93672a1054ab:
    container_name: cceb93672a1054ab
    image: sitehost/sitehost-php84-apache:1.0.1-noble
    ports:
      - 127.0.0.1:8001:80
    volumes:
      - ./application:/container/application
  mariadb1011:
    container_name: mariadb1011
    environment:
      - MARIADB_ROOT_PASSWORD=**YOUR PASSWORD**
    image: sitehost/mariadb1011:1.0.1
  pma:
    container_name: pma
    environment:
      PMA_HOSTS: mariadb1011
      PMA_HOST: ""
    ports:
      - 127.0.0.1:8002:80
    image: sitehost/pma:1.2.5

The service name, like cceb93672a1054ab, is usually an internal ID we give each container. You can call your container anything you'd like, but for consistency we'll follow the same convention locally.

You'll also notice that the mariadb1011 container has the environment variable MARIADB_ROOT_PASSWORD. Replace **YOUR PASSWORD** with the password you'd like to use for the root user of the database.

Running the containers

To run your containers, you want to copy the Docker compose we've provided above into a file called compose.yaml.

Alongside this compose file you want to create an application directory, and then a public folder inside it. This should look familiar to you, as the file structure mirrors your production Cloud Container.

Place your application files inside the public directory, like you would do on your Cloud Container server. You can run the following to create a basic "Hello world!" PHP file.

echo "<?php echo 'Hello world!';" > index.php

Then run docker compose up -d from within the directory where your compose.yaml is sitting.

Viewing your websites

In your compose.yaml file you'll see that two of the services defined have a ports section. The services running within your Docker containers are isolated from the host machine, and these ports sections allow us to map ports on your host machine to ports within the containers, so that you can reach these websites from your local browser.

For example, the application container has 127.0.0.1:8001:80 defined in the ports section. This tells us that we're mapping port 80 within the container, to port 8001 on your host machine. So you can access this website at http://localhost:8001

Similarly, the PHPMyAdmin container has 127.0.0.1:8002:80 defined in the ports section, so you'll reach this service at http://localhost:8002.

A port can only be used by one service at a time, so you'll want to make sure that you choose a unique port for each service you're running locally.