If you launched your cockpit project using docker, you probably used this command:
docker run -d --name cockpit -p 8080:80 agentejo/cockpit
You might want to change the port at which this container is deployed. I looked around for the solution and I did find an answer on Stackoverflow. I think a better solution with exact commands is required though.
- Use
docker ps
to get the first few letters of your container ID - Stop docker using
docker service stop
- Navigate to /var/lib/docker/containers/your-container-id. You might have to do this as a root user
- Open the
hostconfig.json
file and find the “HostPort” key. Change your port to whatever you want here. Save the file and exit. - Start docker again using
docker service start
- Use
docker ps
to check if the port has changed
I hope this helps someone!