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
- Create the Docker Compose file:
-
Navigate to the
/opt/docker/
directory:bash cd /opt/docker/
-
Create the
docker-compose.yml
file using a text editor likenano
:bash nano docker-compose.yml
-
Paste the YAML configuration and save the file.
-
Deploy the container:
-
Run the following command to start the container:
bash docker compose up -d
-
Verify the deployment:
-
Check if the container is running:
bash docker ps
-
Ensure the port mapping is correct:
bash docker-compose config
-
Test accessibility by navigating to
http://<docker_host_ip>:3003
in a browser.
Let me know if you need any adjustments or troubleshooting!