How to change port of docker container on Ubuntu 18.04 LTS

Find the hash of the container with “docker ps -a” Stop the docker container with “docker stop” Next you have to stop docker all together with “sudo systemctl stop docker.service” and also “sudo systemctl stop docker.socket” Then you cd to /var/lib/docker/containers/<hash_of_container> Now open with your favorite text editor hostconfig.json Look for “HostPort”:”<port_you_want>”