Skip to content

Compose example

Setting up the environment based on those guidelines requires a properly defined docker-compose.yml file. Below is an example of how you can structure it:

services:
  webserver:
    image: httpd:latest
    container_name: httpd
    ports:
      - "3003:80"
    volumes:
      - "/opt/finance:/usr/local/apache2/htdocs"

Steps to implement

  1. Create the Docker Compose file:
  2. Navigate to the /opt/docker/ directory:

    bash cd /opt/docker/

  3. Create the docker-compose.yml file using a text editor like nano:

    bash nano docker-compose.yml

  4. Paste the YAML configuration and save the file.

  5. Deploy the container:

  6. Run the following command to start the container:

    bash docker compose up -d

  7. Verify the deployment:

  8. Check if the container is running:

    bash docker ps

  9. Ensure the port mapping is correct:

    bash docker-compose config

  10. Test accessibility by navigating to http://<docker_host_ip>:3003 in a browser.

Let me know if you need any adjustments or troubleshooting!