Docker - Portainer Container Setup


Here I describe my setup of the Portainer container.

I run this Docker container on a Ubuntu VM that runs via [[ Proxmox VE ]]. I perform the following on the CLI.

Docker pull command:

docker pull portainer/portainer-ce

Within my home folder I have created a Docker folder where I create a subfolder for each container:

cd ~
mkdir -p docker/portainer
cd docker/portainer

Also create a folder where the Portainer data can be stored:

mkdir data

Perform the following once to generate an encrypted password:

htpasswd -nb -B admin PASSWORD | cut -d ":" -f 2

Apache2-utils is required to run the above and is normally installed within Ubuntu.

Adjust the following:

PASSWORD
Replace this with your own password

Save the result of the htpasswd command.

I use the Nano text editor to create a shell script:

sudo nano portainer_run.sh

With this shell script we are going to create the container. Copy the following into portainer_run.sh:

docker run -d \
 --init \
 --hostname=portainer \
 --name=portainer \
 -p 9000:9000 \
 -p 8000:8000 \
 -v /var/run/docker.sock:/var/run/docker.sock \
 -v $PWD/data:/data \
 -e TZ="Europe/Amsterdam" \
 --restart=unless-stopped \
 --cap-add=NET_ADMIN \
 portainer/portainer-ce \
--no-analytics \ 
--admin-password=’PASSWORD’ \

If necessary, adjust the following:

-p 9000:9000 and -p 8000:8000
Choose a port that is still available. Check this with netstat

-v $PWD/data:/data portainer/portainer
Choose the location for the Portainer data. In this example it is the data map we created

-e ‘TZ=Europe/Amsterdam’
Pick the right timezone

–no-analytics
Remove this line if you want to enable analytics

–admin-password=’PASSWORD’
Replace PASSWORD with the encrypted password you generated with htpasswd

Exit Nano (CTRL-X) and save the changes.

Now create the container:

sudo sh portainer_run.sh

Check if the container is running properly.

Using Portainer

Portainer can now be accessed via the following URL:

http://<IP DOCKER HOST>:9000/

Now log in with admin and the password you used before.

Tip: Under Settings it is possible to disable Allow the collection of anonymous statistics

See also my notes about updating containers with Portainer or via the CLI. With Synology’s Docker Application, updating a container is also very easy.


Read other notes

Comments

    No comments found for this note.

    Join the discussion for this note on this ticket. Comments appear on this page instantly.

    Tags


    Notes mentioning this note


    Notes Graph