Sometimes you need to expose additional port on running container without rebuilding it from image.
Here are steps which worked for me:
- stop the container
- stop docker service (can skip - restart later is enough)
- change the files
/var/lib/docker/containers/<conainerID>
config.v2.json
"Config": {
....
"ExposedPorts": {
"80/tcp": {},
"8888/tcp": {}
},
....
},
"NetworkSettings": {
....
"Ports": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
],
hostconfig.json
"PortBindings": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
],
"8888/tcp": [
{
"HostIp": "",
"HostPort": "8888"
}
]
}
restart your docker engine (to flush/clear config caches)
systemctl restart docker
- start the container