Skip to content

juliocesarscheidt/micro-portainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx Proxy for Docker API

Using Docker API being proxied by Nginx, to expose its information on some UI made with VueJS.

Based on Portainer: https://docs.portainer.io/v/ce-2.9/start/install/server/docker/linux

Running Portainer:

docker volume create portainer_data

docker container run -d \
  -p 8000:8000 \
  -p 9443:9443 \
  --name portainer \
  --restart=always \
  -v portainer_data:/data \
  -v /var/run/docker.sock:/var/run/docker.sock \
  portainer/portainer-ce:2.9.3
# access on https://localhost:9443

docker container logs -f --tail 50 portainer

# clean up
docker container rm -f portainer
docker volume rm portainer_data

Up and Running (image from Docker Hub)

https://hub.docker.com/repository/docker/juliocesarmidia/micro-portainer

# default docker API version used: 1.41
docker container run -d \
  -p 8080:8080 \
  --name micro-portainer \
  --restart=always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  juliocesarmidia/micro-portainer:latest
# access on http://localhost:8080

# logs
docker container logs -f --tail 50 micro-portainer

# clean up
docker container rm -f micro-portainer

Up and Running (local build)

# retrieve current docker API version
export V_DOCKER_API="$(docker version | awk '/^\sAPI\sversion/{print $3}')"

docker-compose up -d --build micro-portainer
# access on http://localhost:8080

# logs
docker-compose logs -f --tail 50 micro-portainer

UI access

http://localhost:8080

image

Registries

Docker Hub

https://hub.docker.com/repository/docker/juliocesarmidia/micro-portainer

export DOCKERHUB_USERNAME='juliocesarmidia'
export DOCKERHUB_TOKEN=''
# login
echo "$DOCKERHUB_TOKEN" | docker login docker.io -u "$DOCKERHUB_USERNAME" --password-stdin
# push image
docker image push "docker.io/$DOCKERHUB_USERNAME/micro-portainer:latest"

Github

https://github.com/juliocesarscheidt/micro-portainer/pkgs/container/micro-portainer

In order to use the GITHUB_TOKEN in CI with Github Actions to push the image to ghcr.io registry, we need to enable the following config in the package configuration:

image

Also, we need to add the repository to manage Actions access, and set the permission to write:

image

export GITHUB_USERNAME='juliocesarscheidt'
export GITHUB_TOKEN=''
# login
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin
# tag and push image
docker image tag "docker.io/juliocesarmidia/micro-portainer:latest" "ghcr.io/$GITHUB_USERNAME/micro-portainer:latest"
docker image push "ghcr.io/$GITHUB_USERNAME/micro-portainer:latest"