Moving a Docker container to another machine

Dear All,

Here my scenario is moving a running docker container to another machine, I created an image which is Oracle database.

Here the steps I followed:

In Source machine:

  1. docker commit
  2. docker save mynewimage > /tmp/mynewimage.tar

Moved the mynewimage.tar to target machine.

In Target Machine;

  1. docker load < /tmp/mynewimage.tar
  2. docker run <container ID/imagename>

When I gave run the command I was hoping that it will open as alike the running database in source, but it was trying to create a new one and failed.

I’m I wrong? It’s a feature of docker that we can move a container with running database to another machine right? But it’s not working please assist

Kind Regards,
Hadley T.A

Does it import an image or a container? If it’s a container, try start instead of run.
I haven’t tried it yet, but I use commit quite often. Make sure the run command is the same which you used to start it, e.g. include ports, names, links etc.

1 Like

Yes my bad, I made a mistake now it’s running fine, Thanks a million.

But still it’s creating a new one right not just a copy of source, that’s how it works? or any other way to shift the exact clone of source?

Thanks for the valuable support.

Regards,
Hadley

Scenario :

Moving a running database to another server:

Expected: As per features we were expecting the exact clone (oracle database) of source to target.

In Source server;

  1. Installed oracle database.

  2. Created some data (tables with data)

  3. Committed and saved the docker image.

  4. Moved the tar file to target server.

In Target Server:

  1. Load the tar file

  2. Image is loaded

  3. Docker run

  4. But the o/p is creating a new database and I couldnt see any data created in source.

Scenario 2:

“How does a Docker image work?
We’ve already seen that Docker images are read-only templates from which Docker containers are launched. Each image consists of a series of layers. Docker makes use of union file systems to combine these layers into a single image. Union file systems allow files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system.”

How to perform this scenario when comes to oracle databae?

Kind Regards,
T.A Hadley

Having the same problem, i.e. move a container with its associated data volume to a new server.
Does containers address this problem at all??