Solved Portainer : connection to endpoint down when restarting the container

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

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) ?
 
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
 
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 :)
 
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: 38
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

How did you create the Portainer container in first place? As in exact docker run commands or in case...
Replies
7
Views
1,356
Root of this issue found;) For unknown reason, the docker package on the first, failing DS, uses the...
Replies
3
Views
1,227
What has worked for me is to stop the container, remove the container, optionally remove the image, and...
Replies
5
Views
5,597
  • Question
No, you have to update the stack choosing the "update the stack" button at the stack editor window. Only...
Replies
11
Views
4,077
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
3,089
  • 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
5,151

Welcome to SynoForum.com!

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

Registration is free, easy and fast!

Trending threads

Back
Top