0

the laptops I use are mac or linux.

But I also work with windows containers.

These containers are very large so using them on a windows VM is a pain because it uses up lots of disk space.

Is there some way of connecting to a remote windows docker host from mac or linux in a more seamless way? So I can run docker commands against a dockerfile locally but it executes on a remote windows server?

red888
  • 27,709
  • 55
  • 204
  • 392

1 Answers1

1

Enable remote access to Docker API on your remote host (Windows system in your case). You may need to enable also auth to be safe.

Then just configure env variable which will point your local docker client to remote API (remote docker daemon), for example:

export DOCKER_HOST=tcp://<IP>:<PORT>

See doc for more details about env variables. There is env variable also for auth (DOCKER_CERT_PATH): https://docs.docker.com/engine/reference/commandline/cli/#environment-variables

This approach works with Docker API and all files, which you are using in the container/in build process from host OS must be available also on the remote machine.

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59
  • That's works with cli commands? If I run docker build how does the dockerfile and other files get from my PC to the remote docker host? – red888 Dec 29 '18 at 13:02
  • Yes, that works with docker command in CLI. And no, it didn't synchronize your files from your local host to the remote machine = you need to copy Dockerfile to Windows machine, but then you will be able to run build from Mac. You need a different approach for the file sync. Maybe NFS RW mount to your local Mac. – Jan Garaj Dec 29 '18 at 13:17