appleboy / appleboy/drone-ssh

dial tcp: lookup host.docker.internal on 127.0.0.11:53: no such host

Open
#208 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
314
Forks
79
Avg merge
3m
Merged PRs (30d)
1

Description

different ssh localhost on mac/raspi

## Mac

> all pipeline work right

* docker-compose.yml

```yaml
# 版本
version: "3.7"

# 服务
services:

# 暂不支持设置时区
drone-runner-mac:
container_name: drone-runner-mac
image: drone/drone-runner-docker:1.8.2
restart: on-failure
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
# - TZ=${TIME_ZONE:-Asia/Shanghai}
- DRONE_RPC_HOST=drone.${SERVER_DOMAIN}
- DRONE_RPC_PROTO=https
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
- DRONE_RUNNER_CAPACITY=1
- DRONE_RUNNER_LABELS=os:macos
# extra_hosts:
# - host.docker.internal:host-gateway # Docker 20.10

# 暂不支持设置时区
drone-runner-mac-ssh:
container_name: drone-runner-mac-ssh
image: drone/drone-runner-ssh:latest # 1.0.1
restart: on-failure
ports:
- 3000:3000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
# - TZ=${TIME_ZONE:-Asia/Shanghai}
- DRONE_RPC_HOST=drone.${SERVER_DOMAIN}
- DRONE_RPC_PROTO=https
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
- DRONE_RUNNER_CAPACITY=1
- DRONE_RUNNER_LABELS=os:macos # 指定 os:macos,则 .drone.yaml 也许指定 node 含 os:macos 才能调用
# extra_hosts:
# - host.docker.internal:host-gateway # Docker 20.10
```

* .drone.yml

```yaml
kind: pipeline
type: ssh
name: macos-ssh

server:
host: host.docker.internal:22
user:
from_secret: MAC_USER
password:
from_secret: MAC_PASSWORD

clone:
disable: true

steps:
- name: build
commands:
- uname -a

node:
os: macos

---
kind: pipeline
name: plugin-macos-ssh

clone:
disable: true

steps:
- name: build
image: appleboy/drone-ssh:1.6.4
environment:
MAC_USER:
from_secret: MAC_USER
MAC_PASSWORD:
from_secret: MAC_PASSWORD
settings:
host: host.docker.internal
port: 22
username:
from_secret: MAC_USER
password:
from_secret: MAC_PASSWORD
envs: [ MAC_USER,MAC_PASSWORD ]
script_stop: true # 遇到错误自动停止
script:
# - date -R
# - echo $MAC_USER/$MAC_PASSWORD
# - system_profiler SPSoftwareDataType
- uname -a
# - bash -lc 'flutter --version'

node:
os: macos
```

## Raspi

> raspi-ssh work right
> ❌ plugin-raspi-ssh work wrong - dial tcp: lookup host.docker.internal on 127.0.0.11:53: no such host

* docker-compose.yml

```yaml
# 版本
version: "3.7"

# 服务
services:

# 暂不支持设置时区
drone-runner-raspi:
container_name: drone-runner-raspi
image: drone/drone-runner-docker:1.8.2
restart: on-failure
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
# - TZ=${TIME_ZONE:-Asia/Shanghai}
- DRONE_RPC_HOST=drone.${SERVER_DOMAIN}
- DRONE_RPC_PROTO=https
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
- DRONE_RUNNER_CAPACITY=1
- DRONE_RUNNER_LABELS=os:raspi
extra_hosts:
- host.docker.internal:host-gateway # Docker 20.10

# 暂不支持设置时区
drone-runner-raspi-ssh:
container_name: drone-runner-raspi-ssh
image: drone/drone-runner-ssh:latest # 1.0.1
restart: on-failure
ports:
- 3000:3000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
# - TZ=${TIME_ZONE:-Asia/Shanghai}
- DRONE_RPC_HOST=drone.${SERVER_DOMAIN}
- DRONE_RPC_PROTO=https
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
- DRONE_RUNNER_CAPACITY=1
- DRONE_RUNNER_LABELS=os:raspi # 指定 os:raspi,则 .drone.yaml 也许指定 node 含 os:raspi 才能调用
extra_hosts:
- host.docker.internal:host-gateway # Docker 20.10
```

* .drone.yml

```yaml
kind: pipeline
type: ssh
name: raspi-ssh

server:
host: host.docker.internal:22
user:
from_secret: RASPI_USER
password:
from_secret: RASPI_PASSWORD

clone:
disable: true

steps:
- name: build
commands:
- uname -a

node:
os: raspi

---
kind: pipeline
name: plugin-raspi-ssh

platform:
os: linux
arch: arm

clone:
disable: true

steps:
- name: build
image: appleboy/drone-ssh:1.6.4
environment:
RASPI_USER:
from_secret: RASPI_USER
RASPI_PASSWORD:
from_secret: RASPI_PASSWORD
settings:
host: host.docker.internal
port: 22
username:
from_secret: RASPI_USER
password:
from_secret: RASPI_PASSWORD
envs: [ RASPI_USER,RASPI_PASSWORD ]
script_stop: true # 遇到错误自动停止
script:
# - date -R
# - echo $RASPI_USER/$RASPI_PASSWORD
- uname -a

node:
os: raspi
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with docker-compose.yml and .drone.yml, comparing the working raspi-ssh pipeline with the failing plugin-raspi-ssh pipeline and their host.docker.internal configuration. Reproduce the plugin pipeline and trace the DNS lookup failure; done means the raspi SSH plugin connects successfully and runs uname -a without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, go
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.