Skip to content

Instantly share code, notes, and snippets.

@dazeb
Last active January 20, 2024 18:32
Show Gist options
  • Save dazeb/5a21646ca030e1bc37fc91c7e529d5b3 to your computer and use it in GitHub Desktop.
Save dazeb/5a21646ca030e1bc37fc91c7e529d5b3 to your computer and use it in GitHub Desktop.
Portainer WebUI for Docker under Alpine Linux

Intro

Run Portainer WebUI for Docker on a docker host built using Alpine (3.8) Linux

Clarifications

About documentation

Despite documentation publicly available on Internet, Portainer is not specially well documented in regard to docker volumes and other similar stuff. Best approach is to handle ourselves the volumes mounted per container.

About (self-signed) certificates

You need to have certificates already created to pass to the docker command line / docker composer. Easier way to have that certificates is to use selfsigned certificates. Following line creates a 10-year valid self-signed certificates:

openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout server.key -out server.crt
docker pull portainer/portainer-ce:alpine

Command line

docker run -d --restart unless-stopped -p 443:9000 --name portainer \ 
           -v /var/run/docker.sock:/var/run/docker.sock \
           -v /var/opt/portainer/portainer_data:/data portainer/portainer \
           --ssl --sslcert /data/ssl/server.crt \
           --sslkey /data/ssl/server.key
  • where /data inside the container is mapped against /var/opt/portainer/portainer_data on the docker host.

  • thus /data/ssl directory used for certificates is in fact /var/opt/portainer/portainer_data/ssl on the docker host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment