Docker, Testcontainers and Apple Silicon

As I am waiting for DHL to deliver new Mac Book Air with M1 chip, I am working on setting up my work environment on it. Well, just virtually preparing the setup as I do not have the machine yet. What I know is that almost every program for Intel based Macs should be running on the new M1 via Rosetta 2 emulation. But some programs I use, such as Docker, will not run until there is native version of it.

Good thing about Docker is that you can run its daemon on other machine and instruct your machine to connect to it just by setting DOCKER_HOST environment variable. That means either exposing port that daemon runs on, or to establish a ssh tunnel and make that port or unix socket available on your local machine. So I am using command like
ssh -L 2375:remote.docker.host:/var/run/docker.sock user@remote.docker.host
and setting
export DOCKER_HOST=tcp://localhost:2375
After doing this all docker containers run on remote.docker.host.

The only problem I had was when using Testcontainers that it expected all containers it started to be available at localhost:xxx, so quick read of documentation showed simple solution:
export TESTCONTAINERS_HOST_OVERRIDE=remote.docker.host

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 11 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.