Docker Swarm - Portainer - Ubuntu - ci/cd
hesam
Posted on November 20, 2024
Login to your server
Create a new user
adduser hesam
usermod -aG sudo hesam
-
su - hesam
Install Docker
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt install docker-ce
-
sudo usermod -aG docker hesam
Install Portainer
docker swarm init
curl -L https://downloads.portainer.io/ce2-19/portainer-agent-stack.yml -o portainer-agent-stack.yml
-
docker stack deploy -c portainer-agent-stack.yml portainer
- open {server-ip}:9000
Connect Portainer to Gitlab
- create a new registry (Gitlab accessToken)
- deploy a new stack (image from gitlab registry)
- copy your service's webhook API
- curl webhook in deploy stage to update service
- push image to registry in build stage
- docker login registry.gitlab.com
pull image
💖 💪 🙅 🚩
hesam
Posted on November 20, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.