Not able create same restored Rancher server from committed Rancher server container in Docker host

I have created rancher server with this command below:

sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

I have worked on the rancher server for some time. Now I want to backup this rancher container and deploy into new rancher container with the same data (Environment, Stacks, Containers … etc) that I have worked earlier in the old rancher server.

I stopped the current running container and I have committed that container into new image. I have created a container from that image. But in that newly created rancher server was empty. The environments, containers, stacks… etc all the configurations are gone.

This the command I have created the rancher server container from that newly created rancher server image:

sudo docker run -d --restart=unless-stopped -e CATTLE_PROMETHEUS_EXPORTER=true -p 8080:8080 -p 9108:9108 ranjith/mainrancher

How to backup and restore container with same data? How to restart the same container with different configurations?

/var/lib/mysql where all the state is kept is a volume and not part of the image. Attach it to something to save externally (-v /somehwere/on/host:/var/lib/mysql or -v some-volume:/var/lib/mysql) or use --volumes-from old_container_id to reuse it across containers.

1 Like

Thanks for the reply. I have created a new container with old container id. It worked as expected.

Thanks for the knowledge. actually, I am an assignment help provider but sometimes I would love to do some gardening.

Best Assignment Help