I’m trying to create an image and run a container from it as a step in the pipeline, but I want it on specific network.
# docker network ls
NETWORK ID NAME DRIVER SCOPE
d9317920b1a6 apps bridge local <---- I want it here
73318eaa1b75 bridge bridge local
1c68cdc44f29 host host local
4e63843bcd0a none null local
In order to do that, I have a drone/drone-runner-docker:1
container added to this network. I see it when I run docker network inspect apps
. I also see every all containers that are created when I run my pipeline.
Now, my pipeline is rather simple:
kind: pipeline
type: docker
name: default
steps:
- name: build
image: docker:dind
volumes:
- name: dockersock
path: /var/run
commands:
- sleep 20
- docker network ls
# - docker build *whatever*
# - docker run -d --net=apps *whatever*
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
this build step produces the following:
+ sleep 20
+ docker network ls
NETWORK ID NAME DRIVER SCOPE
7ac1733c9a7b bridge bridge local
5152fdb46e9e host host local
507a2585be0b none null local
What I actually noticed right now is that these are all names except apps
but they have different IDs which means they aren’t the same as in the beginning
As I understand this problem, I don’t actually need “docker in docker” solution, I need to connect to my top-level Docker. What I need to change? Do I need to adjust volumes:
section somehow to mount my main /var/run/docker.sock
?