is it possible (using the docker
command or the docker-py
API directly) to start a container from a remote host?
Lets assume I have two machines that have different architectures:
- A is an x86
machine
- B is an ARM
machine
I would like to run a container on the B machine using my A machine. At first, I thought it was possible using this command:
[A]$> DOCKER_HOST=$MACHINE_B_IP:$MACHIN_B_PORT docker run hello-from-B
But this command actually pulls the image hello-from-B
and tries to run it on the machine A which ends up on some exec format error
cause obviously you can't run images that are specific to ARM
to an x86
machine.
Communication between machine A and B is working well. I can run commands like images
or ps
and it gives me the expected results:
[A]$> DOCKER_HOST=$MACHINE_B_IP:$MACHIN_B_PORT docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-from-B <none> fd5059044831 13 hours ago 1.26GB
I've heard about docker-machine
and haven't tried it yet, but from my understanding, this won't solve my problem.
Is there any way to achieve that using docker
directly. A workaround might be to using ssh
to connect to the remote host and use the docker
client directly from the remote host, but I'd like to avoid this solution as much as possible.
Thanks in advance,
TL;DR;
How can DOCKER_HOST=... docker run something
runs something
on the DOCKER_HOST
rather than running it on my local machine.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…