Preface
Main idea: Add a docker container using Portainer
Apache
pull httpd
(Apache) image
docker pull httpd
Container configuration
- name: yourapp_apache
- image: httpd:latest
scroll down, in menu Manual network port publishing is important things that you must set up port which mean as host. The host I’m prefer to not same with another container. So, in this case I choose 8090.
For container is using port 80 which mean default port for HTTP. This is all you need for adding Apache container. Then deploy the container.
and here is
Your webpage is ready just click in Published Ports. Otherwise go to menu Connected Networks you will se IP address where just generated by portainer 172.17.0.2
To start container automatically, there is 5 option
Flag | Description |
---|---|
no | Do not automatically restart the container. (the default) |
on-failure | Restart the container if it exits due to an error, which manifests as a non-zero exit code. |
always | Always restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in restart policy details) |
unless-stopped | Similar to always , except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts. |
And I prefer to always
MariaDB
and setup environment for your container. To run correctly, the RDBMS such as MariaDB or MySQL minimal need to set default root password, because this will cause error while you run it.
MYSQL_ROOT_PASSWORD = oranggila123
and deploy the container
and you can using always
on Restart policy to restart automatically when it container manually stop.