Portainer Issues With Docker Update FYI
from irmadlad@lemmy.world to selfhosted@lemmy.world on 12 Nov 20:38
https://lemmy.world/post/38712055

If you just updated Docker and are having issues with Portainer not connecting to the environment, check this:

Issue: Failed loading environment The environment named <your specific environment> is unreachable

Fix (credit xman601):

Stop Docker

sudo systemctl stop docker

Make sure you have the Docker official repository added for your Ubuntu version. In my case Ubuntu Jammy

sudo apt update
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg


echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt update

Install the specific Docker version

sudo apt install docker-ce=5:28.5.2-1~ubuntu.24.04~noble \
                 docker-ce-cli=5:28.5.2-1~ubuntu.24.04~noble \
                 containerd.io

or if you are on 22:

sudo apt install docker-ce=5:28.5.2-1~ubuntu.22.04~jammy \
                 docker-ce-cli=5:28.5.2-1~ubuntu.22.04~jammy \
                 containerd.io

Prevent Ubuntu from automatically upgrading Docker:

sudo apt-mark hold docker-ce docker-ce-cli

Start Docker again

sudo systemctl start docker
sudo systemctl enable docker

Verify the version

docker --version

You should see:

Docker version 28.5.2, build …

Once this issue has been fixed you can run the following to update docker back

sudo apt-mark unhold docker-ce docker-ce-cli

Referance: github.com/portainer/portainer/issues/12925

It should go without saying, you should do your due diligence reviewing and confirming any code snippets found on the internet before you drop them in on a production environment.

#selfhosted

threaded - newest

tophneal@sh.itjust.works on 12 Nov 22:14 collapse

You can also add an override for the docker.service file to specify min api version 1.24. Had to do that last night

irmadlad@lemmy.world on 12 Nov 22:37 collapse

add an override for the docker.service file

Can you elaborate? I made the post hoping to save someone a couple hours banging their head on the keyboard like I did. LOL

So something like :

sudo nano /usr/lib/systemd/system/docker.service

What was the format of your entry to specify a minimum api version 1.24? I’m curious and always down to learn new tricks.

'presh

deleted@lemmy.world on 13 Nov 08:31 next collapse

You just need to do the following:

  1. systemctl edit docker.service

  2. Add this part above the line ### Lines below this comment will be discarded:

[Service] Environment=DOCKER_MIN_API_VERSION=1.24

  1. Save the file and exit

  2. systemctl restart docker

Credit to johannesMEGABAD github.com/portainer/portainer/issues/12925#issue…

irmadlad@lemmy.world on 13 Nov 13:29 collapse

Awesome. Thanks

tophneal@sh.itjust.works on 13 Nov 13:24 collapse

Here’s the method I used from one of the issues on GitHub github.com/portainer/portainer/issues/12925#issue…

Iirc my docker.socket wouldn’t let me just stop docker.service to edit it as described in the post, so I made /etc/systemd/system/docker.service.d/override.conf with the 2 required lines. After saving it and running daemon-reload I was able to access my containers in portainer again.

irmadlad@lemmy.world on 13 Nov 13:29 collapse

Alright! Alright! More ways to skin a cat. Thanks.