Docker Community Forums

Share and learn in the Docker community.

Add new port to an active docker container

I am new to docker so some of the terminology that I may use might be wrong.

As the title says, I am trying to add a new port to an active docker container.
Reason: Connect to the mysql inside the container
If you have other solutions or other ways that I need to do aside from this, please do tell me.

How I created my docker container

docker pull centos:centos6
docker run -it -d -p 8080:80 --name myprogram centos:centos6

Right now it is running smoothly but if I want to check the mysql DB inside the container, I need to access the docker container and check via terminal.

I installed a gui for mysql, however I cant access the database from host.

How should I process on this?

Help would be appreciated.

Thank you.

May I suggest to get yourself acquainted with docker to actualy have a fighting chance to understand and succeed in what you’re trying to achive with docker? You might want to take a look at this highly recommended free self-paced docker training: https://container.training/intro-selfpaced.yml.html.

1 Like

docker run -it -d -p 8080:80 -p 3306:3306 --name myprogram centos:centos6

Thank you for the detail.
nice post!
Merchant crypto