我启动了一个 Docker 容器,docker-compose up它创建了 7 个新的网络接口。这些都出现在gkrellm中。
不幸的是,每次 Docker 启动时,它都会为网络接口创建新的随机名称。首选项现在充满了旧界面!
如何隐藏这些界面而不显示在 Gkrellm 中?
对于奖励积分,如何从配置中删除旧接口?
我正在尝试设置一个 Ubuntu 容器,openssh-server以便我可以从主机 ssh 进入它。我知道这不是标准的做法,但我真的很想这样做ssh。
这是我的Dockerfile
# Select base image\nFROM ubuntu:16.04\n\n# Set the current working directory\nWORKDIR /home\n\n# Update the system, download any packages essential for the project\nRUN dpkg --add-architecture i386\nRUN apt-get update && apt-get upgrade -y\nRUN apt-get install -y git build-essential make gcc vim net-tools iputils-ping ca-certificates openssh-server libc6:i386 libstdc++6:i386\n\n# Allow ssh root login\nRUN echo "root:root" | chpasswd\n\n# RUN rpl "PermitRootLogin prohibit-password" "PermitRootLogin yes" /etc/ssh/sshd_config\nRUN sed -i \'s/prohibit-password/yes/\' /etc/ssh/sshd_config\n\nRUN cat /etc/ssh/sshd_config\nRUN mkdir /root/.ssh\n\nRUN …Run Code Online (Sandbox Code Playgroud) 我创建了一个 docker-composer.yml
version: '2'
services:
nginx:
image: nginx:stable-alpine
ports:
- "80:80"
Run Code Online (Sandbox Code Playgroud)
运行 docker-composer 后,
ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
Run Code Online (Sandbox Code Playgroud)
所以我运行 docker-compose --verbose up -d 输出如下:
File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
chunked=chunked)
File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", …Run Code Online (Sandbox Code Playgroud) 我试图揭示调用Multi-Image的 CircleCI 功能实现的技术细节。
它们允许以这种方式指定多个图像:
test-job:
docker:
- image: nginx
- image: circleci/mariadb:10.2
Run Code Online (Sandbox Code Playgroud)
然后,他们基于第一个映像(nginx在本例中)在 Docker 容器中运行构建。如果您连接到nginx容器,您mysqld也可能会看到那里的进程:
PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND
...
7 0 999 S 2518m 2% 31 0% mysqld
...
Run Code Online (Sandbox Code Playgroud)
看起来他们将一个进程从mariadb容器附加到nginx容器。
怎么可能呢?我在docker中没有看到这样的能力。
我认为它的工作原理就像同一个 Kubernetes pod 中的多个容器一样,但事实并非如此。您看不到同一 Pod 上其他容器中某个容器中的进程。
有任何想法吗?
从今天起,每当我使用带有bridge网络接口的任何 docker 容器时,某些实用程序的 DNS 解析似乎都失败了。
例如,如果我运行:
sudo docker run --rm \
--cap-add=NET_ADMIN \
--log-driver json-file \
--log-opt max-size=10m \
--net=bridge --dns 9.9.9.9 \
alpine \
sh -c 'apk add curl bind-tools; printf "\nDATE:\n"; date; printf "\nRESOLV.conf\n"; cat /etc/resolv.conf; printf "\nDIG:\n"; dig api.nordvpn.com; printf "\nTRACE:\n"; dig +trace api.nordvpn.com; printf "\nHOST:\n"; host -va api.nordvpn.com; printf "\nNSLOOKUP:\n"; nslookup api.nordvpn.com; printf "\nCURL:\n"; curl api.nordvpn.com; printf "\nPING:\n"; ping -c 5 api.nordvpn.com; printf "\nWHOIS:\n"; whois api.nordvpn.com; printf "\nRESOLVE:\n"; systemd-resolve --status'
Run Code Online (Sandbox Code Playgroud)
我回来了:
DATE:
Sun Jul …Run Code Online (Sandbox Code Playgroud) 如何修复这些 APT 存储库错误?我正在使用 Debian GNU/Linux 9.13(延伸)。我正在修复此更新错误并导入 Docker GPG 密钥。
root@test:~# apt-get update
Ign:1 http://security.debian.org stretch/updates InRelease
Err:2 http://security.debian.org stretch/updates Release
404 Not Found [IP: 111.73.1113.145 90]
Get:3 https://download.docker.com/linux/debian stretch InRelease [44.8 kB]
Ign:4 http://ftp.de.debian.org/debian stretch InRelease
Err:5 http://ftp.de.debian.org/debian stretch Release
404 Not Found
Err:3 https://download.docker.com/linux/debian stretch InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7PB0A8C2F192FFDM
Reading package lists... Done
E: The repository 'http://security.debian.org stretch/updates Release' does no longer have a Release file.
N: …Run Code Online (Sandbox Code Playgroud) RUN apt-get update && \
# Install locales
apt-get install -y locales && \
# Set locale
sed --in-place '/en_US.UTF-8/s/^# //' /etc/locale.gen && \
locale-gen && \
# Set system locale (add line)
echo "export LANG=en_US.UTF-8" >> /etc/profile && \
# Set system timezone (add line)
echo "export TZ=UTC" >> /etc/profile && \
# If the user will not change, we must source
source /etc/profile
Run Code Online (Sandbox Code Playgroud)
我在 GitLab 管道中使用该图像,并显示以下内容:
$ cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell …Run Code Online (Sandbox Code Playgroud) 我有一个从 Linux 机器复制过来的日志文件列表。如何在 Mac 上阅读这些内容?
system.journal
system@00057f81c3557a96-72d9555724020539.journal~
system@00057f81c3578ad2-0b1342e26a1084c2.journal~
system@00057f81c35da2ae-1e08ad8d9fb4490e.journal~
system@00057f81c36061ae-4887cabc406c0730.journal~
system@00057f81c3610f02-a2ef88fdd0f7b8b8.journal~
system@00057f81c361f8c9-291d730f905c8c13.journal~
system@00057f81c3622e0e-e11a80ce27e19d78.journal~
system@000581375327165b-1ebd65852c52012b.journal~
system@000581414f1d5717-3fb84669d371cc85.journal~
system@000581414f1eb991-d03234bfd7e97526.journal~
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Docker 容器内模拟无头 chrome 实例的麦克风输入。
基于在 Docker 容器内模拟 Chrome 的麦克风输入,我有以下设置:
Dockerfile
FROM buildkite/puppeteer:latest
RUN apt-get -qq update && apt-get install -y pulseaudio
COPY entrypoint.sh /opt/bin/entrypoint.sh
RUN useradd -ms /bin/bash bot
USER bot
ENTRYPOINT /opt/bin/entrypoint.sh
Run Code Online (Sandbox Code Playgroud)
entrypoint.sh
FROM buildkite/puppeteer:latest
RUN apt-get -qq update && apt-get install -y pulseaudio
COPY entrypoint.sh /opt/bin/entrypoint.sh
RUN useradd -ms /bin/bash bot
USER bot
ENTRYPOINT /opt/bin/entrypoint.sh
Run Code Online (Sandbox Code Playgroud)
运行容器时pulseaudio -D --verbose --exit-idle-time=-1失败,但没有更多详细信息:
E: [pulseaudio] main.c: Daemon startup failed.
Run Code Online (Sandbox Code Playgroud)
我可以排除pulseaudio在容器内自动启动的可能性,因为后续输出如下:
Connection failure: Connection refused
Connection failure: Connection …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用环境变量在 Docker 容器内运行命令,但我无法找出正确的语法。
我可以看到变量设置正确:
$ docker exec -e FOO=bar cfdb72_db_1 env | grep FOO
FOO=bar
Run Code Online (Sandbox Code Playgroud)
我认为双美元符号 ( $$) 在这里可以工作,但打印出一个奇怪的数字。
$ docker exec -e FOO=bar cfdb72_db_1 echo $FOO
$ docker exec -e FOO=bar cfdb72_db_1 echo '$FOO'
$FOO
$ docker exec -e FOO=bar cfdb72_db_1 echo \$FOO
$FOO
$ docker exec -e FOO=bar cfdb72_db_1 echo $$FOO
24136FOO
Run Code Online (Sandbox Code Playgroud) mcr.microsoft.com/dotnet/aspnet:5.0我尝试使用需要具有 top 命令的图像在 docker 容器中部署应用程序
当我尝试运行 top 命令时,显示以下结果:
bash: top: command not found
Run Code Online (Sandbox Code Playgroud)
如何安装 top 命令?
我对如何设置从 WSL docker 容器内返回到 Windows 上的路由有点迷失。我应该指出,我故意不使用 Docker Desktop。
所以这是场景:
我在 Windows 10 计算机上安装了 MariaDB,使用标准 IP 和端口 127.0.01:3306。
确切地说,我有一个通过 WSL 2 从 Windows 商店 Ubuntu 20.04 LTS 安装的更新实例 Ubuntu。
在 Ubuntu 上,我安装了一个 docker,并与正在运行的 Centos 容器一起工作。
我需要我的 PHP 项目能够与 Windows 安装的 MariaDB 进行通信。我的困惑是,在我的 docker 容器(centos)中,我可以设置我的 /etc/hosts 文件将域 local_db 指向 -> 127.0.0.1 但我相信这使得它只尝试在 docker 镜像中进行自我通信(其中当我访问该域时,不存在数据库实例。此外,在 Unbuntu 上我可以做同样的事情,但我不能确定它是否真的会在 Windows 上与正确的端口通信,或者它是否只是包含在 Ubuntu 中无法退出。
那么问题是,我如何不仅能够从 docker 容器到达/路由到 WSL,而且还能到达/路由到 Windows?
我的一些研究表明,我需要以某种方式使用 0.0.0.0 来“绑定到任何东西/所有东西”,但仅仅尝试使用它而不是 localhost(我相信各位专家都知道)被证明是不够的。
感谢您的指导!
docker ×13
linux ×9
networking ×3
debian ×2
ubuntu ×2
bash ×1
dns ×1
installation ×1
iptables ×1
locale ×1
mac ×1
nginx ×1
openssh ×1
pulse-audio ×1
repository ×1
routing ×1
ssh ×1
systemd ×1
top ×1
updates ×1
windows-10 ×1