How to change the network of a running docker container?

后端 未结 2 930
闹比i
闹比i 2021-02-18 17:46

I\'m trying to update the network of a running docker container.

Note: I didn\'t attach any network while running the container.

[root@stagingrbt ~]# doc         


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-02-18 18:02

    If you want to circumvent the command line and change the network of your docker container via portainer, you can do so. I'm not sure exactly which is the best way of doing this, but the steps below worked for me (changing a container that was running on the bridge network by default into the host network):

    1. In the Container list, click on the container name (emby, in my case)
    2. Stop the container
    3. Click on Duplicate/Edit
    4. Scroll down to Advanced container settings and select the Network tab
    5. Change the Network to host (or whatever you want to set it to)
    6. Click on Deploy the container right above.
    7. Confirm that you want to replace the old container (or deploy it under a new name if you want to be on the save side and keep the old one).
    8. Done!

提交回复
热议问题