Hilscher Community Forum
[SOLVED] Modifying ports after container is being added. - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Software (https://forum.hilscher.com/forum-5.html)
+--- Thread: [SOLVED] Modifying ports after container is being added. (/thread-206.html)



[SOLVED] Modifying ports after container is being added. - SteveO - May-8th-2018

Do you know of a way to modify the ports after I’ve added the container? I need to add a port, but don’t want to redo the process.


Answer - Armin@netPI - May-9th-2018

Hello Steve,

this is a feature that is not supported by Docker in general. It is not something netPI specific.

See the docker run... command reference here https://docs.docker.com/engine/reference/run/ which is called internally when you click to add container in the web GUI.

But I have a tip for you. When you click to the name of the the existing container in the containers overview page and you click to create then the GUI will generate you an image copy of the container as it is. Then afterwards you can start this image again as a container and make correct port settings to your demands. Of course you should stop the other origin container before, else previous ports are occupied.




Answer - SteveO - May-9th-2018

In other words, you can go into Docker>Containers. Click on the checkbox of your original container (make sure it is the only one checked) and click Stop. Click on the name (not the checkbox) of your container that you are talking about. After the “Container details” page opens, go down to “Create image” and click on the blue Create button. Click on Images on the left side bar and verify that a new image was created (probably at the bottom of the list with no Tag). Copy the Id to the clipboard.
Go to Containers on the left side bar. Click on +Add container. Name the container. Paste the Id of the image into Image. Turn off Always pull the image button. Continue to create the container as you did on your previous container entering all of the necessary information, but put in the correct port(s) that you want to use (if you are going to use the previous ones they also have to be entered). When all information is done, click Start container. Go back to Containers on the left side bar. Make sure all checkboxes are Unchecked. Check the box on your new container and click Start.