如何在不ping某些网站的情况下测试互联网连接?我的意思是,如果有连接但网站已关闭怎么办?有检查与世界的联系吗?
试图安装在泊坞机内,无论是vim还是nano,但我只能得到这个:
0% [Connecting to archive.ubuntu.com (91.189.88.152)]
Run Code Online (Sandbox Code Playgroud)
退出码头并做ping archive.ubuntu.com,我得到回复,同时在docker内做它没有响应.
可能是什么问题呢?
当我连接到公司的 VPN 时,我无法通过 Docker 容器访问互联网。例如,运行docker run -it ubuntu apt update将失败,并显示消息“Err:1 http://archive.ubuntu.com/ubuntu focus InRelease
解决‘archive.ubuntu.com’临时失败”
断开 VPN 连接并不能解决问题。(参见解决方法#2)
我有两个解决方法:
docker run -it --net=host ubuntu apt update可以正常工作,但是,这对于我公司的脚本和构建系统来说不是合适的解决方法。它适用于临时工作。# /bin/bash
docker system prune -a
systemctl stop docker
iptables -F
ip link set docker0 down
brctl delbr docker0
systemctl start docker
Run Code Online (Sandbox Code Playgroud)
将允许它再次工作 - 但随后我无法访问公司的内部服务器,而这也是构建我们的软件所需要的。
我已经尝试过这些事情:
我在我的Ubuntu OS上使用了2个容器:Gitlab-ce和gitlab-runner
容器名称是:gitlab_gitlab_1和gitlab_gitlab-runner_1
我通过访问我的gitlab应用程序 gitlab.localhost.com:801
我用这个命令成功注册了一个跑步者:
docker exec -it gitlab_gitlab-runner_1 gitlab-runner register --non-interactive --url http://gitlab_gitlab_1 --registration-token _wgMgEx3nBocYQtoi83c --executor docker --docker-image alpine:latest
Run Code Online (Sandbox Code Playgroud)
然后,当我开始工作时,我收到此错误消息:
Running with gitlab-runner 10.7.1 (b9bba623)
on 589a617ee407 12ba77f7
Using Docker executor with image alpine:latest ...
Pulling docker image alpine:latest ...
Using docker image sha256:3fd9065eaf02feaf94d68376da52541925650b81698c53c6824d92ff63f98353 for alpine:latest ...
Running on runner-12ba77f7-project-1-concurrent-0 via 01196621a827...
Cloning repository...
Cloning into '/builds/root/test'...
fatal: unable to access 'http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.localhost.com/root/test.git/': Could not resolve host: gitlab.localhost.com
ERROR: Job failed: exit code 1
Run Code Online (Sandbox Code Playgroud)
在这两个容器中,我都可以访问主机名gitlab.localhost.com …
刚刚使用安装指南安装了docker 1.10.1.但是,除非我--net=host在docker run命令中使用,否则我的容器都不能访问Internet .我试过这些帖子的各种解决方法:
到目前为止,除了添加--net=host到run命令之外没有任何工作,但我无法从Dockerfile构建图像,因为我无法使用--net=host该build命令.
我跑去docker network inspect bridge检查docker网桥的设置,发现它使用(几乎)与我的工作VPN相同的子网和网关.这可能导致问题吗?这也可以解释为什么当我连接到我的工作VPN时,一些站点无法加载.
这是由以下结果docker network inspect bridge:
[
{
"Name": "bridge",
"Id": "6d603ebd1c437d0d1f02be8406cf362f7f36d33168e42b9883891bae99834fa9",
"Scope": "local",
"Driver": "bridge",
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
}
}
]
Run Code Online (Sandbox Code Playgroud)
这是ifconfig:
docker0 Link encap:Ethernet …Run Code Online (Sandbox Code Playgroud) 我可以从主机盒(Linux centos rhel 7.2)ping IP,但是当我在docker容器内执行相同操作时,它无法响应。
[root@f321ef079128]# ping 10.254.19.46 PING 10.254.19.46 (10.254.19.46) 56(84) 字节数据。
可能是什么问题?
谢谢
Edit: I've managed to realize that the issue is with bridge networking, as network functionality seems fine with --net=host.
docker run -it --net=host busybox ping -c 1 8.8.8.8 works consistently.
Looking at this thread on reddit Docker network problem. Only works with --net=host the OP's issue was resolved by uninstalling ebtables. I've done the same but still have the same problem.
--
I've read through numerous threads (see below) trying to get to the bottom of an issue I'm …
我无法构建 jmeter docker 文件,出现以下错误。
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:
curl (missing):
required by: world[curl]
fontconfig (missing):
required by: world[fontconfig]
net-tools (missing):
required by: world[net-tools]
shadow (missing):
required by: world[shadow]
su-exec (missing):
required by: world[su-exec]
tcpdump (missing):
required by: world[tcpdump]
ttf-dejavu (missing):
required by: world[ttf-dejavu]
The command '/bin/sh -c chmod +x /usr/local/bin/entrypoint.sh && apk add --no-cache curl fontconfig net-tools shadow su-exec tcpdump ttf-dejavu && cd /tmp/ && …Run Code Online (Sandbox Code Playgroud) 我有一个基本的 OpenShift 起源集群oc cluster up
现在,在默认的“MyProject”中,我想从 git repo 构建源,但失败并出现错误
Could not resolve host: github.com; Name or service not known
即使我尝试设置 gogs 并将 github.com 上的公共托管源代码迁移到 gogs pod,但抛出了相同的错误。
请告知在 OpenShift 集群设置期间是否需要任何其他网络设置才能访问 github.com 或任何其他公共域。我可以感觉到这是一个网络问题,但不确定集群上到底需要配置什么。
我正在尝试在docker容器中构建我的go项目。
这是dockerfile:
FROM golang:1.12.9 as builder
ENV GO111MODULE=on
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o encashment
FROM scratch
COPY --from=builder /app/encashment /encashment/
EXPOSE 8080
ENTRYPOINT ["/app/encashment"]
Run Code Online (Sandbox Code Playgroud)
我在go.mod中只有一个依赖项:
require github.com/gorilla/mux v1.7.3
Run Code Online (Sandbox Code Playgroud)
如果我gorilla/mux在本地删除并致电go mod download,则一切正常。但是当我打电话docker build .回来时
go: finding github.com/gorilla/mux v1.7.3
go: github.com/gorilla/mux@v1.7.3: unknown revision v1.7.3
go: error loading module requirements
Run Code Online (Sandbox Code Playgroud)
如何使这项工作?
UPD:这是tcpdump输出:
19:00:00.220102 IP 172.17.0.2.43627 > dns.google.domain: 15472+ A? …Run Code Online (Sandbox Code Playgroud) docker ×7
networking ×2
ping ×2
bash ×1
connection ×1
dns ×1
dnsmasq ×1
dockerfile ×1
gitlab-ci ×1
go ×1
go-modules ×1
jmeter ×1
linux ×1
ubuntu ×1
ubuntu-14.04 ×1
vpn ×1