我在Windows 主机 (Windows Server 2016 TP4)上运行Windows 容器。
容器应在内部端口 80 上运行IIS 网络服务器,我还想将端口 80 绑定到主机,以便我可以通过主机 IP/URL 访问它。
我按照 Microsoft 的说明进行操作
我通过 Powershell 和 Docker 尝试了这两种方法,在这两种情况下,绑定到主机的端口都不起作用。
========================== Powershell 方法 ======================== ===
将容器主机部署到现有系统(Windows Server 2016 TP4)
PS C:> wget -uri https://aka.ms/tp4/Install-ContainerHost -OutFile C:\Install-ContainerHost.ps1
PS C:> powershell.exe -NoProfile C:\Install-ContainerHost.ps1
Querying status of Windows feature: Containers...
Feature Containers is already enabled.
Waiting for Hyper-V Management...
Networking is already …Run Code Online (Sandbox Code Playgroud) networking port-forwarding container docker windows-server-2016
我创建了一个 docker 容器,它在错误的时区运行。我个人需要它在我的时区运行(欧洲/斯德哥尔摩,GMT+1)。由于该项目是开源的,其他用户也可能希望改变它。我希望任何人都可以轻松地在 Dockerfile 或 docker-compose.yml 中更改它。
如果可能,我还希望该解决方案不仅适用于 CentOS,以防有人希望使用不同的发行版。
在我的 docker 容器中设置本地时间/时区的最与发行版无关的方法是什么?
这两种方法似乎很常见,但我不确定它们是否真的对我来说是最好的方法:
一些 Linux 发行版读取 TZ 环境变量。但是,我注意到当我使用centos:7图像时它不起作用。
您可以在 docker-compose.yml 中将容器映射/etc/localtime到/etc/localtime主机上。但是这样做时,使用的发行版/etc/timezone会保留在 UTC 和软件中,这些软件可能正在读取然后会读取错误的时区。
我在执行 easy_install pip 时遇到以下错误消息:
root@ff45b7b74944:/# easy_install pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading [--https link here, like above--]
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for pip
error: …Run Code Online (Sandbox Code Playgroud) 我的最终目标是在 Windows 10 Pro(评估)中为 Windows 运行 docker。
要做到这一点,
安装失败,因为它需要启用“虚拟化”,如https://github.com/docker/for-win/issues/74 中所述
我已经为 VM 配置了“硬件虚拟化”设置,如下所示......但它仍然没有在来宾 Windows 操作系统中启用
有关如何启用它的任何线索?
我正在使用 Docker for Mac v 1.12.3,我遇到的问题是 HTTP 和 HTTPS 连接非常慢。DNS 和 Ping 看起来不错,但 HTTP(S) 在 docker 镜像上需要 5 秒,但在主机上需要 0.05 秒:
Host (MacOS Sierra):
time curl www.google.com
0.05 real
0.00 user
0.00 sys
Docker:
time curl www.google.com
real 0m5.615s
user 0m0.010s
sys 0m0.000s
Run Code Online (Sandbox Code Playgroud)
我看不出任何原因或任何其他有同样问题的人。
有任何想法吗?
这是我第一次使用docker。我只是按照 docker 网站上的步骤操作:https :
//docs.docker.com/get-started/part2/#run-the-app
完成每个步骤后,我无法http://localhost:4000从浏览器访问。(链接中的这些步骤将在 docker 中映射 80 到 4000)这是我的 docker 的配置:
$ docker ps
CONTAINER ID IMAGE COMMAND
STATUS PORTS NAMES
d204920463a9 firendlyhello "python app.py"
Up 6 minutes 0.0.0.0:4000->80/tcp pensive_bell
Run Code Online (Sandbox Code Playgroud)
当我运行这个应用程序时:
liyuan.liu@USEUG-98T5N32 MINGW64 ~/test
$ docker run -p 4000:80 firendlyhello
* Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
Run Code Online (Sandbox Code Playgroud)
然后我试图在我的浏览器中打开http://localhost:4000,但它只是说:无法访问此站点。这是 app.py 内容:
liyuan.liu@USEUG-98T5N32 MINGW64 ~/test
$ cat app.py
from flask import Flask
from redis import Redis, RedisError
import os
import socket
# Connect to …Run Code Online (Sandbox Code Playgroud) 我将我的 Debian 内核从 3.x 更新到 4.x。
Docker 存储变成了overlay2。
ls /var/lib/docker/
containers image network overlay2 plugins swarm tmp trust volumes
Run Code Online (Sandbox Code Playgroud)
旧的目录结构是
aufs containers graph image init linkgraph.db network plugins repositories-aufs swarm tmp tmp-old trust volumes
Run Code Online (Sandbox Code Playgroud)
我的 docker 图像和 aufs 目录中包含存储,我无法使用旧目录启动 docker 服务。如何将我的图像从旧目录移动到新目录?
我在 chroot 环境中的 arm64 android 手机中安装了 debian stretch。我已经按照这里的这些步骤安装了 docker-ce 。
在启动泊坞窗时:: systemctl start docker
返回此错误:: Running in chroot, ignoring request.
使用service docker status节目 检查[FAIL] Docker is not running ... failed!
如果我运行 using dockerd,它会显示此错误::
INFO[2018-02-05T22:15:35.631735524+05:30] libcontainerd: started new docker-containerd process pid=23047
INFO[0000] starting containerd module=containerd revision=89623f28b87a6004d4b785663257362d1658a729 version=v1.0.0
INFO[0000] setting subreaper... module=containerd
INFO[0000] changing OOM score to -500 module=containerd
INFO[0000] loading plugin "io.containerd.content.v1.content"... module=containerd type=io.containerd.content.v1
INFO[0000] loading plugin "io.containerd.snapshotter.v1.btrfs"... module=containerd type=io.containerd.snapshotter.v1
WARN[0000] failed to load plugin …Run Code Online (Sandbox Code Playgroud) sleep 当然,它是大多数复杂过程的替代品。
这个 Dockerfile(如您所见,使用 exec 形式,因此只有一个进程在运行,并且没有 的子进程bash):
FROM busybox
CMD ["/bin/sleep", "100000"]
Run Code Online (Sandbox Code Playgroud)
创建一个不间断的容器:
docker build -t kill-sleep .
docker run --rm --name kill-sleep kill-sleep
Run Code Online (Sandbox Code Playgroud)
当我试图阻止它时:
time docker stop kill-sleep
kill-sleep
real 0m10.449s
user 0m0.021s
sys 0m0.027s
Run Code Online (Sandbox Code Playgroud)
命令在容器被杀死前 10 秒超时。
问题不在于sleep不处理信号,因为如果我在主机上运行它:
sleep 100000
# in another shell
ps faxww | grep sleep
kill -TERM 31333 # the PID
Run Code Online (Sandbox Code Playgroud)
该过程立即停止。
问题可能与它在容器中作为 PID 1 运行的事实有关,但我还没有看到相关的参考文档。
Docker 有一个文档页面,其中列出了 Compose 版本及其支持的 Docker 引擎版本。简而言之:
Compose 文件格式 Docker Engine 发布 ----------------------------------------- 3.6 18.02.0+ 3.5 17.12.0+ 3.4 17.09.0+ 3.3 17.06.0+ 3.2 17.04.0+ 3.1 1.13.1+ 3.0 1.13.0+ ...
我知道我可以在我的撰写文件 ( version: "3.6") 中使用特定的主要/次要版本,但是如果我不指定次要版本 ( version: "3") 会怎样?这是否表现为“3.0”、安装的最新 Compose 版本或支持我安装的 Docker 引擎的最高 Compose 文件格式?
举例来说,我有
我用version: "3". 我可以访问哪些功能集?3.0、3.3、3.5 还是 3.6?
docker ×10
linux ×3
arm ×1
centos ×1
chroot ×1
container ×1
debian ×1
easy-install ×1
macos ×1
networking ×1
pip ×1
python ×1
ssl ×1
virtualbox ×1
windows-10 ×1