CMD我的 dockerfile 是这样的:["python", "myproject/start_slide_server.py"]
但是,为了使其工作,我需要将其设置PYTHONPATH为/app,它是myproject
如果我启动 docker 进程并覆盖CMD,bash我可以运行以下命令
root@42e8998a8ff7:/app# export PYTHONPATH=.
root@42e8998a8ff7:/app# python myproject/start_slide_server.py
* Running on http://0.0.0.0:8090/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 236-035-556
Run Code Online (Sandbox Code Playgroud)
它按预期工作
现在我添加一行
RUN export PYTHONPATH=/app
Run Code Online (Sandbox Code Playgroud)
前
CMD ["python" , "myproject/start_slide_server.py"]
Run Code Online (Sandbox Code Playgroud)
它刚刚失败了
Traceback (most recent call last):
File "/app/myproject/start_slide_server.py", line 23, in <module>
from myproject import env
ImportError: No module named myproject
Run Code Online (Sandbox Code Playgroud)
看起来这RUN条线根本没有任何影响
我真的不想 …
我正在运行一个小臂板,在我们的本地网络内提供一些服务。当我尝试了解 docker 对 ipv6 的支持时,我对第一次测试的结果感到非常困惑。
我的网络由使用 dhcpv6 的单个路由控制,每个客户端都有 2 个有效的全局 ipv6 地址(还有 1 个本地 ipv4),并受到路由器防火墙的保护(不允许从互联网到客户端的请求)。
Arm 板运行的是 ubuntu 16.04,具有有效的 ipv6 地址并启用了隐私扩展。
所有docker容器都使用默认的桥接网络,没有任何调整。
在docker主机上
netstat -tulpen|grep docker
Run Code Online (Sandbox Code Playgroud)
节目
tcp6 0 0 :::8080 :::* LISTEN 0 22490 1559/docker-proxy
Run Code Online (Sandbox Code Playgroud)
没有一个 ipv4 服务正在侦听。
在这个 docker 容器内,相同的 netstat 请求给出
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 23955 8/nginx
tcp6 0 0 :::80 :::* LISTEN 0 23956 8/nginx
Run Code Online (Sandbox Code Playgroud)
Nginx 正在侦听 ipv6 和 ipv4 - 端口 80 暴露给端口 8080
docker run (...) -p 8080:80 (...)
Run Code Online (Sandbox Code Playgroud)
检查桥接网络
docker …Run Code Online (Sandbox Code Playgroud) 我在 ubuntu:16.04 基本映像上运行 tftpd-hpa。当我在完整发行版上运行它时,它记录正常,但在 docker 容器内没有任何日志。它似乎正在尝试登录到丢失的 /var/log/syslog 。有人对我如何从中获取一些日志有任何建议吗?
详细程度设置为 4,这在完整的 Ubuntu 16.04 安装上提供了合适的详细输出,但在容器中没有任何输出。
谢谢
我正在尝试为开发环境构建 ubuntu-server 容器,但系统提示我选择键盘布局和字符集。
docker run --rm it ubuntu
Run Code Online (Sandbox Code Playgroud)
在容器中:
apt-get update && apt-get install -y ubuntu-server
Run Code Online (Sandbox Code Playgroud)
(然后我最终会提示选择和键盘,然后是字符集。)
容器可以工作 - 但它是交互式的 :( 我想用 Dockerfile 以非交互式方式重复这个过程。
Dockerfile:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y ubuntu-server
Run Code Online (Sandbox Code Playgroud)
构建它:
docker build -t ubuntu-server .
Run Code Online (Sandbox Code Playgroud)
- 失败
如何在容器中以非交互方式构建/安装 ubuntu-server?
CentOS 中的默认 Docker 安装从 Cgroup 开始systemd。我从官方 YUM 仓库安装了 Kubernetes,systemddrop-in 10-kubeadm.conf有以下内容:
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true"
Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
Environment="KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 --cluster-domain=cluster.local"
Environment="KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt"
Environment="KUBELET_CADVISOR_ARGS=--cadvisor-port=0"
Environment="KUBELET_CGROUP_ARGS=--cgroup-driver=systemd"
Environment="KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true --cert-dir=/var/lib/kubelet/pki"
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS
Run Code Online (Sandbox Code Playgroud)
我还尝试获取环境变量以查看 systemd 插件是否正确覆盖 ( systemctl show --property=Environment kubelet | cat):
Environment=KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf\x20--kubeconfig=/etc/kubernetes/kubelet.conf KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests\x20--allow-privileged=true KUBELET_NETWORK_ARGS=--network-plugin=cni\x20--cni-conf-dir=/etc/cni/net.d\x20--cni-bin-dir=/opt/cni/bin KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10\x20--cluster-domain=cluster.local KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook\x20--client-ca-file=/etc/kubernetes/pki/ca.crt KUBELET_CADVISOR_ARGS=--cadvisor-port=0 KUBELET_CGROUP_ARGS=--cgroup-driver=systemd KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true\x20--cert-dir=/var/lib/kubelet/pki
Run Code Online (Sandbox Code Playgroud)
当我使用 初始化集群时kubeadm init --apiserver-advertise-address=X.X.X.X --pod-network-cidr=10.244.0.0/16,过程成功。但是,运行kubelet version会给我一个 Cgroup 配置错误错误:
error: failed to run Kubelet: failed to create …Run Code Online (Sandbox Code Playgroud) 我有一个带有 Docker 17.05.0-ce 的 CentOS 7.4 VM,我正在尝试将其配置为某些 docker 容器的主机。
给我的指导之一是禁用用户空间代理。我创建了一个/etc/docker/daemon.json与
{
"userland-proxy": false
}
Run Code Online (Sandbox Code Playgroud)
我的问题 - 如果我将该值设置为 true,我可以在系统的其他地方查看什么或测试(iptables?docker info?)以查看切换该值会产生什么不同?
我相信我的问题源于不完全理解 userland-proxy 是什么,尽管阅读了网络页面。
我有几个进程停留在不间断的睡眠状态,似乎都源于auplink /var/lib/docker/aufs/mnt. 这是 docker 相关的东西,它正在等待一个永远不会完成的 I/O——我明白了,但我如何确定确切的原因?我怎么知道它在等待什么 I/O?另外,如果没有硬重启,真的没有办法让这些卡住的进程消失吗?
有时在 OpenShift 中启动 Postgres POD 时会显示以下错误代码
pg_ctl: another server might be running; trying to start server anyway
waiting for server to start....LOG: redirecting log output to logging
collector process
HINT: Future log output will appear in directory "pg_log".
..... done
server started
=> sourcing /usr/share/container-scripts/postgresql/start/set_passwords.sh ...
ERROR: tuple concurrently updated
Run Code Online (Sandbox Code Playgroud) 我知道容器使用主机的内核,据我所知,这就是我们不需要操作系统的原因。我的问题是(我在网上找不到任何好的解释):
1) 如果是这种情况,那么我们是否会收到 shell 提示以及我们如何在容器上添加 systemctl、services 等内容
2) 例如,我们如何在 Ubuntu 主机上安装 CentOS 容器?在这种情况下,容器是否在容器映像中安装了操作系统?
我尝试使用docker只需安装此 docker 容器https://hub.docker.com/r/mdillon/postgis/
从手册运行此命令:
docker run --name some-postgis -e POSTGRES_PASSWORD=mysecretpassword -d mdillon/postgis
Run Code Online (Sandbox Code Playgroud)
现在要输入psql:
su postgres
Run Code Online (Sandbox Code Playgroud)
而我就是无法登录。我一直认为这postgres是默认密码,但不允许这样做。
我可以错过什么?
docker ×10
ubuntu ×3
containers ×2
linux ×2
postgresql ×2
centos ×1
centos7 ×1
cgroup ×1
ipv6 ×1
kubernetes ×1
linux-kernel ×1
logging ×1
namespaces ×1
netstat ×1
python ×1
systemd ×1
tftp ×1
ubuntu-16.04 ×1