Solved Portainer : connection to endpoint down when restarting the container

Currently reading
Solved Portainer : connection to endpoint down when restarting the container

162
45
NAS
DS918+ (8GB RAM, 4x WD RED 4TB SHR) ; EATON Ellipse PRO 1200FR
Operating system
  1. Windows
Mobile operating system
  1. Android
There might be a misunderstanding here ...

jphermans said:
Did the restart myself.
What did you restart yourself ? DSM or Portainer from the DSM Docker UI ?

jphermans said:
But what if there is a current breakdown ? That's the same situation as what you did.
Yeah sure pulling the cord blabla... it like power breakdown without a UPS (which I have but in my case the cord disconnection was between UPS and NAS 🤷‍♂️ )

Now what if you go to DSM docker UI, stop portainer from there and then start portainer still from there ?
Is it able to connect to the local endpoint (your NAS /var/run/docker.sock) ?
 
141
36
NAS
DS1815+
Operating system
  1. Linux
  2. macOS
Mobile operating system
  1. iOS
Last edited:
Now what if you go to DSM docker UI, stop portainer from there and then start portainer still from there ?
Is it able to connect to the local endpoint (your NAS /var/run/docker.sock) ?
You have to check if the symlink to /var/run/docker.sock still exist. When the nas reboot for some reason the symlink is created in a start task.

Code:
bash ln -s /var/run/docker.sock /volume1/docker/docker.sock
 
162
45
NAS
DS918+ (8GB RAM, 4x WD RED 4TB SHR) ; EATON Ellipse PRO 1200FR
Operating system
  1. Windows
Mobile operating system
  1. Android
You have to check if the symlink to /var/run/docker.sock still exist. When the nas reboot for some reason the symlink is created in a start task.

Code:
bash ln -s /var/run/docker.sock /volume1/docker/docker.sock
There is no symlink involved in my configuration. My container creation code contains -v /var/run/docker.sock:/var/run/docker.sock which will map the actual docker.sock in the container
 
I created my smlink from the docker share to /var/run/docker.sock once a couple of years ago and never had issues with Portainer (when I was still using it) or Watchtower. It might not been the most elagant solution, but it sure is a reliable solution... no matter what :)
 
2
1
NAS
DS918+
Operating system
  1. Windows
Mobile operating system
  1. Android
Hello,

Yesterday, I decided to try portainer to see what it can do and if I can use it to manager my containers instead of DSM UI and I have successfully installed Portainer on my DS918+. It seems to work properly until I restart the container.
Whenever I stop/start the container, it is not able to reconnect to my endpoint. I have to destroy and recreate the container each time to get it to connect to the endpoint.

Below is the command I use to create the container :
Code:
docker create --name=portainer --restart=always -p 9000:9000 -v /volume3/docker/portainer-data:/data -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer:latest

And this is the error I see in the container's logs when I want to connect to the endpoint after a restart :
Code:
http error: Unable to proxy the request via the Docker socket (err=context canceled) (code=500)

Hint, idea anyone ? :)
Thanks
Today I ran into the same problem and I think I found what happens.
By flipping the 'switch' for stopping or running the container in Docker in DSM GUI, the Portainer container does not get broken. But once you stop the container either through the DSM GUI or CLI with the command 'docker stop portainer' and click the 'Edit' button in the DSM GUI and hit the 'APPLY' button, the container is broken and will say 'down' in the portainer portal.
The problem is that the the DSM GUI will remove the volume mounting path 'var/run/docker.sock:/var/run/docker.sock'. It is not possible to recreate the volume mounting path from the DSM GUI, as it allows you to pick from files shares only and does not provide a 'field entry'.
I have not found a way how to 're-add' the volume mounting path to the docker container through the CLI. Workaround for now is to delete the container from the DSM GUI and run the same docker run command again you use as well.
The addition of --pid=host does not make a difference.

The yellow marked volume mounting path is removed by DSM GUI:
1609796210069.png

In the running container that is not edited in DSM GUI yet, you will see the following volume mounting path displayed:
1609796265207.png


'Switch' in DSM GUI:
1609796284906.png


Once you edit the container in DSM GUI and hit APPLY, it will say 'down' in the Portainer portal:
1609796306456.png
 

Attachments

  • 1609796235998.png
    1609796235998.png
    47.3 KB · Views: 32
162
45
NAS
DS918+ (8GB RAM, 4x WD RED 4TB SHR) ; EATON Ellipse PRO 1200FR
Operating system
  1. Windows
Mobile operating system
  1. Android
That's exactly my conclusion after some research...
Since the docker UI is limited when you interact with a container in the UI which has been created outside the limits of the UI, the container may break because the UI will not recognize all the vars, parameters and so on.
Now when I need to interract with portainer, I do it in CLI and when I need to interract with other containers, I do it with portainer.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

That's what I said earlier. Yes, I have no need for the Edge, as all my boxes are either in the same LAN...
Replies
11
Views
673
  • Question
You're welcome. But if you had replied to the earlier posts if you had mapped /data to a NAS folder then...
Replies
11
Views
2,412
🍪 🍺 🍪 🍺 🍪 🍺 Major embarrassment... I should have caught this from @Rusty 's comment. In my docker...
Replies
10
Views
3,102
@DeltaGolf Here’s my approach: Docker - NextCloud on Synology NAS using Docker compose (with Portainer)
Replies
18
Views
2,509
late follow-up on this, here is the tutorial I followed for setup and the upgrade process that is supposed...
Replies
5
Views
2,815
  • Question
I analysed it a while ago: It is not possble to create stacks in Portainer on Synology's customized docker...
Replies
1
Views
2,171

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Top