# \[SOLVED\] Using insecure docker registry with plugin/docker

**URL:** <https://drone.discourse.group/t/solved-using-insecure-docker-registry-with-plugin-docker/11410>\
**Category:** Drone Support\
**Created:** [November 6, 2020, 10:00am UTC](https://drone.discourse.group/t/solved-using-insecure-docker-registry-with-plugin-docker/11410 "2020-11-06T10:00:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![misamae](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/misamae/32/3034_2.png) [@misamae](https://drone.discourse.group/u/misamae)\
**Post date:** [November 6, 2020, 10:00am UTC](https://drone.discourse.group/t/solved-using-insecure-docker-registry-with-plugin-docker/11410/1 "2020-11-06T10:00:44Z")

</div>

I have created a docker private insecure registry and configured the daemon.json file so that push and pull to the insecure repository would work from the host machine. However, when I try to use images from the private insecure repository inside the plugin/docker I get the following error:

```auto
Step 1/8 : FROM 192.168.100.1:5000/python:3.7.8-slim-stretch
Get https://192.168.100.1:5000/v2/: http: server gave HTTP response to HTTPS client

```

To narrow this down I created a sample Docker file pull from local registry and realised the following command works and builds the docker successfully:

```auto

docker run --rm \
  -e PLUGIN_TAG=latest \
  -e PLUGIN_REPO=192.168.100.1:5000/sample \
  -e DRONE_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \
  -v $(pwd):$(pwd) \
  -w $(pwd) \
  -v /var/run/docker.sock:/var/run/docker.sock \
  --privileged \
  plugins/docker --dry-run

```

However, when I remove the `docker.sock` volume in the following command it does not work:

```auto
docker run --rm \
  -e PLUGIN_TAG=latest \
  -e PLUGIN_REPO=192.168.100.1:5000/sample \
  -e DRONE_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \
  -v $(pwd):$(pwd) \
  -w $(pwd) \
  --privileged \
  plugins/docker --dry-run

```

and here is the output:

```auto
docker run --rm \
> -e PLUGIN_TAG=latest \
> -e PLUGIN_REPO=192.168.100.1:5000/sample \
> -e DRONE_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \
> -v $(pwd):$(pwd) \
> -w $(pwd) \
> --privileged \
> plugins/docker --dry-run
+ /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock
Registry credentials or Docker config not provided. Guest mode enabled.
+ /usr/local/bin/docker version
Client: Docker Engine - Community
 Version: 19.03.8
 API version: 1.40
 Go version: go1.12.17
 Git commit: afacb8b7f0
 Built: Wed Mar 11 01:22:56 2020
 OS/Arch: linux/amd64
 Experimental: false

Server: Docker Engine - Community
 Engine:
  Version: 19.03.8
  API version: 1.40 (minimum version 1.12)
  Go version: go1.12.17
  Git commit: afacb8b7f0
  Built: Wed Mar 11 01:30:32 2020
  OS/Arch: linux/amd64
  Experimental: false
 containerd:
  Version: v1.2.13
  GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version: 1.0.0-rc10
  GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version: 0.18.0
  GitCommit: fec3683
+ /usr/local/bin/docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.8
 Storage Driver: overlay2
  Backing Filesystem: <unknown>
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.15.0-122-generic
 Operating System: Alpine Linux v3.11 (containerized)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
WARNING: No swap limit support
 Total Memory: 15.66GiB
 Name: 7fb445ddee82
 ID: WKFW:OL53:JOLQ:MVD2:LWRJ:K2Q7:7D6L:JDDF:LFN3:JOQB:PYOP:ZU3N
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

+ /usr/local/bin/docker build --rm=true -f Dockerfile -t d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab . --pull=true --label org.label-schema.schema-version=1.0 --label org.label-schema.build-date=2020-11-06T09:57:37Z --label org.label-schema.vcs-ref=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab --label org.label-schema.vcs-url=
Sending build context to Docker daemon 76.29kB
Step 1/8 : FROM 192.168.100.1:5000/python:3.7.8-slim-stretch
Get https://192.168.100.1:5000/v2/: http: server gave HTTP response to HTTPS client
time="2020-11-06T09:57:37Z" level=fatal msg="exit status 1"

```

And suggestion how the docker.sock volume may not be mapped from the runner instance to the plugin/docker?

Thanks.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [November 6, 2020, 2:52pm UTC](https://drone.discourse.group/t/solved-using-insecure-docker-registry-with-plugin-docker/11410/2 "2020-11-06T14:52:46Z")

</div>

there is an `insecure` parameter that you can use to enable insecure registries:

```auto
image: plugins/docker
settings:
  insecure: true

```

---

<div class="post-metadata">

**Author:** ![misamae](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/misamae/32/3034_2.png) [@misamae](https://drone.discourse.group/u/misamae)\
**Post date:** [November 6, 2020, 2:55pm UTC](https://drone.discourse.group/t/solved-using-insecure-docker-registry-with-plugin-docker/11410/3 "2020-11-06T14:55:32Z")

</div>

Thanks @bradrydzewski

That fixed the problem. It would be useful for the others starting to use drone to have this documented in this page [http://plugins.drone.io/drone-plugins/drone-docker/](http://plugins.drone.io/drone-plugins/drone-docker/) in the example related to custom registry.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [November 6, 2020, 4:26pm UTC](https://drone.discourse.group/t/solved-using-insecure-docker-registry-with-plugin-docker/11410/4 "2020-11-06T16:26:21Z")

</div>

this field is documented in at the link provided, in the section that lists all available configuration parameters.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [November 6, 2020, 4:26pm UTC](https://drone.discourse.group/t/solved-using-insecure-docker-registry-with-plugin-docker/11410/5 "2020-11-06T16:26:57Z")

</div>


