portainer: "no such exec" failure in Container console on remote host


BUG REPORT INFORMATION

Hello,

The problem has been discussed on slack and I was asked to open an issue with the details.

Having an error in Console view when trying to exec a bash (or sh) into a container with Portainer running on localhost and managing a remote Docker Swarm cluster.

Error in the red box was “rpc error: code = 2 desc = containerd: process not found for container” in my firt test and is now just “no such exec” (maybe due to a different version of Portainer between the test, as I used “latest” tag… ?)

This failure occured with all different kind of images (nginx, …) docker exec works using the CLI against these containers.

Context : the swarm cluster is only accessible on some specific ports because behind a firewall. The port 2376 is opened for the daemon TCP connection.

Tests done :

  • With Portainer running on my local host and managing the remote Swarm portainer_error_local

  • With Portainer running directly on the remote Swarm manager host The error message does not appear…but it does not display the console neither. portainer_error_remote

When I first saw this error, the message was not the same. Maybe a different version of Portainer (I use “latest” tag) Here is a screenshot of the first message : capture

** Steps to reproduce ** (with or without proxy in front of Portainer, same error)

  • start a service (either in Portainer or with docker CLI)
  • the service is displayed in Portainer and the container has been assigned to the worker-3 node
  • switch in Portainer to endpoint “worker-3”
  • Tried the console view on the container => rpc error

Also tested to constraint the service on the manager to not have to switch endpoint in Portainer but same error.

Technical details:

  • Portainer version: 16.X (different versions tested)
  • Target Docker version (the host/cluster you manage): 17.06.2
  • Platform (windows/linux): Linux CentOS 7
  • Browser: Firefox 58.0.2 (64 bits)

Thanks for your help !

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 42 (14 by maintainers)

Most upvoted comments

For me, the fix was to add proxy_set_header directives to my nginx server block.

server {
    listen      80;
    server_name portainer.example.com;

    if ($http_x_forwarded_proto = 'http') {
         return 301 https://$server_name$request_uri;
    }

    location / {
        proxy_pass http://localhost:9000;
        include /etc/nginx/proxy_params;
        proxy_set_header Upgrade websocket;
        proxy_set_header Connection Upgrade;
    }
}

Fix for me was to add the following in both locations: proxy_set_header Origin '';

@cmsalmeida When using Nginx in front of Portainer, a specific configuration must be added, see http://portainer.readthedocs.io/en/stable/faq.html#how-can-i-configure-my-reverse-proxy-to-serve-portainer

We’re investigating this issue.

@deviantony I have been experiencing a very similar problem: I am running portainer behind a caddy-proxy and got the same error. I fixed it by changing my config to:

portainer.example.com {
  log stdout
  errors stdout
  proxy / example.com:9000 {
    websocket
    transparent
  }
}

Maybe you would like to include a caddy example as well in your documentation…

Thank you for the link, updating the Nginx configuration accordingly worked. 👍