Physical machine hosts
file
192.168.32.103 gogs.com
192.168.32.105 drone.com
Gogs virtual machine /etc/hosts
file
192.168.32.105 drone.com
Drone virtual machine /etc/hosts
file
192.168.32.103 gogs.com
The following commands are all operated on the VMware virtual machine.
Gogs Docker Run Command
docker run -d \
-p 8022:22 -p 80:3000 \
--add-host=drone.com:192.168.32.105 \
--name=gogs -v /srv/gogs-data:/data gogs/gogs:latest
Drone Server Run Command
docker run \
--volume=/var/lib/drone:/data \
--add-host=gogs.com:192.168.32.103 \
--env=DRONE_AGENTS_ENABLED=true \
--env=DRONE_GOGS_SERVER=http://gogs.com \
--env=DRONE_RPC_SECRET=Hascalator \
--env=DRONE_SERVER_HOST=drone.com \
--env=DRONE_SERVER_PROTO=http \
--publish=80:80 \
--publish=443:443 \
--restart=always \
--detach=true \
--name=drone-server \
drone/drone:1
Drone Runner Docker Run Command
docker run -d \
--add-host=gogs.com:192.168.32.103 \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DRONE_RPC_PROTO=http \
-e DRONE_RPC_HOST=drone-server \
-e DRONE_RPC_SECRET=Hascalator \
-e DRONE_RUNNER_CAPACITY=2 \
-e DRONE_RUNNER_NAME=${HOSTNAME} \
-p 3000:3000 \
--restart always \
--name drone-runner-docker \
--link drone-server:drone-server \
drone/drone-runner-docker:1
.drone.yml
file content
kind: pipeline
name: Test Drone
type: docker
steps:
- name: Print Hello World
image: centos
commands:
- echo 'Hello, Drone'
- name: Print Secrets
image: centos
environment:
AppID:
from_secret: APP_ID
AppSecret:
from_secret: APP_SECRET
commands:
- echo $$AppID
- echo $$AppSecret
When I push origin master, the Pipeline occurs "Could not resolve host"
Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/heads/master:
fatal: unable to access 'http://gogs.com/yokefellow/drone-practice.git/': Could not resolve host: gogs.com
It's pingable in these two containers(drone-server,drone-runner-docker)
[root@drone ~]# docker container exec -it drone-server /bin/sh
/ # ping gogs.com
PING gogs.com (192.168.32.103): 56 data bytes
64 bytes from 192.168.32.103: seq=0 ttl=63 time=0.629 ms
64 bytes from 192.168.32.103: seq=1 ttl=63 time=0.637 ms
64 bytes from 192.168.32.103: seq=2 ttl=63 time=0.847 ms
64 bytes from 192.168.32.103: seq=3 ttl=63 time=0.451 ms
64 bytes from 192.168.32.103: seq=4 ttl=63 time=0.804 ms
^C
--- gogs.com ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.451/0.673/0.847 ms
[root@drone ~]# docker container exec -it drone-runner-docker /bin/sh
/ # ping gogs.com
PING gogs.com (192.168.32.103): 56 data bytes
64 bytes from 192.168.32.103: seq=0 ttl=63 time=0.759 ms
64 bytes from 192.168.32.103: seq=1 ttl=63 time=0.850 ms
64 bytes from 192.168.32.103: seq=2 ttl=63 time=0.648 ms
64 bytes from 192.168.32.103: seq=3 ttl=63 time=0.753 ms
64 bytes from 192.168.32.103: seq=4 ttl=63 time=0.753 ms
^C
--- gogs.com ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.648/0.752/0.850 ms