How to open 8093 port on running docker?

Hi, I was installed Couchbase by using following docker command

docker run -d --name db -p 8091-8092:8091-8092 -p 11210:11210 couchbase

But above command is outdated. so i need to use following command right now

docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase

If i do new command. all of my server data i will loss. so i can i achive withou loss of my data and i need to run all other ports. please help me on this.

I don’t think there is a way to achieve what you are looking to do with a running container. What you would more than likely need to do in order to save your couchbase data is to commit your current container to a new image and then do a docker run specifying the new port range and the new image name.

Also, just in case you weren’t aware of it, you can persist your data between container restarts (or even between deleting and spinning up new containers) by using a mounted volume. With a mounted volume, you end up storing your couchbase data in a directory on your host computer and then mount that folder into the container at runtime. This way your db data will always be available to your containers no matter how many times you update them/throw them away.

Thanks for reply

Can you please provide steps and commands. So I will do it.

docker commit containerID newImageName:tag
docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 newImageName:tag

Thank u

Hi

For doing this command, can I stop the running container and do the
following

If I do, will rest of ports work without loss of data.

you run the docker commit command on the running container, which will then produce a new image. Then stop the currently running container and run a new container (off of the new image) using the new port range.

Thank you, I will update you once i will done.