portainer: Unable to recreate container with network type container: that was on bridge network

Bug description

When recreating a container that was previously on the bridge with mapped ports and changing the network to container:<container name> the following error shows:

“conflicting options: port exposing and the container type network mode”

Expected behavior The container to have been recreated sharing the network stack of the other container specified.

Steps to reproduce the issue:

Steps to reproduce the behavior:

  1. Create 2 containers A and B on the bridge network with mapped ports
  2. Recreate B while removing the exposed ports but setting the network to “container:A”
  3. See error

Technical details:

  • Portainer version: 1.19.2
  • Docker version (managed by Portainer): 18.06.1-ce
  • Platform (windows/linux): linux
  • Command used to start Portainer (docker run -p 9000:9000 portainer/portainer): docker run --restart always -d -p 9000:9000 -v /mnt/path/portainer/:/data -v /var/run/docker.sock:/var/run/docker.sock --name portainer portainer/portainer:latest
  • Browser:

Additional context I’ve made sure in the UI at least that any mention of port exposing or port mapping is off.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15

Most upvoted comments

@viktorkho FWIW here, I’ve resorted to creating the needed container via the command line with the parameter:

--net=container:other_container

This creates the container as desired and then I can restart the container (if needed) in portainer. Still not ideal as I have to treat that container with care; I haven’t attempted to recreate the container in portainer. But this approach has been getting me by from a functional POV here.