0

Is it possible to add an --insecure-registry=docker.my-registry to the current session only with environment variables or similar?

I'd like to do some testing without changing my current Docker setup (for example I might not be able to restart the service).

Or any similar idea?

Eldad Assis
  • 10,464
  • 11
  • 52
  • 78

2 Answers2

0

Sounds like a bad idea from a security point of view. If that were possible you (or any user) will be able to download images from an insecure registry that's not allowed by docker's sysadmin.

There is no concept of per session images in docker, any downloaded image will be available for all users

edit:

And to answer your question: No, it is not possible.

Darwin
  • 1,809
  • 15
  • 17
0

I was able to solve this issue by using the docker:18.02.0-dind Docker image (Docker in Docker).

I start the DID container:

$ docker run -d --name did --privileged docker:18.02.0-dind --insecure-registry=my.insecure.reg

Then I go into the running container:

$ docker exec -it did /bin/sh

And inside the running container I login to my insecure registry:

/ # docker login -u me -p mypass my.insecure.reg Login Succeeded

In the running container I can now do some tests against my insecure registry.

Eldad Assis
  • 10,464
  • 11
  • 52
  • 78