User Tools

Site Tools


docker:portainer:create_container

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
docker:portainer:create_container [2021/02/05 15:41] – created peterdocker:portainer:create_container [2021/02/05 16:42] (current) peter
Line 1: Line 1:
 ====== Docker - Portainer - Create Container ====== ====== Docker - Portainer - Create Container ======
 +
 +===== Log into Portainer =====
 +
 +Navigate to **127.0.0.1:9000**.
 +
 +----
 +
 +===== Select the Local Docker =====
 +
 +Select your local docker:
 +
 +{{:pi-hole:portainer_-_local.png?800|}}
 +
 +----
 +
 +===== Add Container =====
 +
 +Navigate to **Containers**.
 +
 +Click **Add Container**.
 +
 +{{:pi-hole:portainer_-_containers.png?800|}}
 +
 +----
 +
 +===== Create Container =====
 +
 +  * Name:  **PiHole**.
 +  * image: **pihole/pihole:latest**.
 +  * Publish all exposed network ports to random host ports:  **Disabled**.  Do not publish all exposed ports.  Manually do it:
 +    * **53:53/tcp**.
 +    * **53:53/udp**.
 +    * **67:67/udp**.
 +    * **80:80/tcp**
 +    * **443:443/tcp**
 +
 +{{:pi-hole:portainer_-_create_container_-_pihole.png?800|}}
 +
 +----
 +
 +==== Map some volumes ====
 +
 +In **Advanced container settings**:
 +
 +  * Click on the **Volumes** tab.
 +  * Click **map additional volume**.
 +  * Container:
 +    *  **/etc/dnsmasq.d**.
 +    *  **Bind**.
 +  * Host:
 +    *  **/home/peter/pihole/dnsmasq.d**.
 +    *  **Bind**.
 +  * Click **map additional volume**.
 +  * Container:
 +    *  **/etc/pihole**.
 +    *  **Bind**.
 +  * Host:
 +    *  **/home/peter/pihole/pihole**.
 +    *  **Bind**.
 +
 +<WRAP info>
 +**NOTE:**  Bind mounts are used rather than standard volumes since that allows the location to the folder to be mapped instead of creating a volume in the Docker volumes folder.
 +
 +The /home/peter/pihole/ directory will be automatically created.
 +</WRAP>
 +
 +{{:pi-hole:portainer_-_create_container_-_pihole_-_advanced_container_settings_-_volumes.png?800|}}
 +
 +
 +
 +----
 +
 +==== Set up the network ====
 +
 +This also sets the DNS the image should use.
 +
 +In **Advanced container settings**:
 +
 +  * Click on the **Network** tab.
 +  * Network:  **bridge**.
 +  * Hostname:  **pihole**.
 +  * Primary DNS Server:  **127.0.0.1**.
 +  * Secondary DNS Server:  **192.168.1.1**.
 +
 +<WRAP info>
 +**NOTE:**  As of version 4.1.1 of Pi-Hole, the DNS server for the Docker container itself, localhost (127.0.0.1), must be set as the primary DNS server.
 +
 +The secondary DNS server can be any other DNS server you prefer.
 +</WRAP>
 +
 +{{:pi-hole:portainer_-_create_container_-_pihole_-_advanced_container_settings_-_network.png?800|}}
 +
 +----
 +
 +==== Set the Environment ====
 +
 +Ensures that Pi-hole starts automatically.
 +
 +In **Advanced container settings**:
 +
 +  * Click on the **Env** tab.
 +  * Click **Add environment variable**.
 +    * Name: **TZ**
 +    * Value:  **Europe/Jersey**.
 +  * Click **Add environment variable**.
 +    * Name: **DNS1**
 +    * Value:  **192.168.1.1**.
 +  * Click **Add environment variable**.
 +    * Name: **DNS2**
 +    * Value:  **1.1.1.1**.
 +  * Click **Add environment variable**.
 +    * Name: **WEBPASSWORD**
 +    * Value:  **Password to use with Pi-Hole**.
 +
 +<WRAP info>
 +**NOTE:**  Pi-hole will default to Google DNS Servers of 8.8.8.8 and 8.8.4.4 if the **DNS1** or **DNS2** environment variables are not set.
 +
 +If only 1 upstream DNS server is wanted, put **no** as the value for the **DNS2** variable, otherwise it will default to Google secondary DNS server 8.8.4.4.
 +
 +It is recommended to have two upstream DNS servers in case one goes down.
 +
 +</WRAP>
 +
 +{{:pi-hole:portainer_-_create_container_-_pihole_-_advanced_container_settings_-_env.png?800|}}
 +
 +----
 +
 +==== Set the Restart Policy ====
 +
 +Ensures that Pi-hole starts automatically.
 +
 +In **Advanced container settings**:
 +
 +  * Click on the **Restart Policy** tab.
 +  * Click **Unless Stopped**.
 +
 +{{:pi-hole:portainer_-_create_container_-_pihole_-_advanced_container_settings_-_restart_policy.png?800|}}
 +
 +----
 +
 +==== Deploy the Container ====
 +
 +Click **Deploy the Container**.
  
docker/portainer/create_container.1612539678.txt.gz · Last modified: 2021/02/05 15:41 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki