我对Docker比较陌生,我正在尝试使用Docker compose从我的Dockerfile构建一个自定义图像。
文档文件
FROM continuumio/anaconda3
#create a directory
WORKDIR /home/docker/qts
#copy the dependencies file
COPY ./requirements.txt .
#install necessary packages
RUN pip install --no-cache-dir -r requirements.txt
#Expose ports
EXPOSE 5000
docker-compose.yml
version: "3.8"
services:
pyimg:
build: .
ports:
- 5000:5000
volumes:
- $HOME/Documents/qts:/home/docker/qts
我的问题
运行docker compose build没有错误。当我执行docker run-it时
docker inspect(docker inspect)也显示卷没有装载(我公开的端口也没有映射到本地端口!)我错过了什么?
谢谢你的意见。
[
{
"Id": "cc506e95df8788349090b310bfa6965b56dbb9e218efe4a9024eb2f502a2d2f2",
"Created": "2021-02-27T14:44:14.9474339Z",
"Path": "bash",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 2712,
"ExitCode": 0,
"Error": "",
"StartedAt": "2021-02-27T14:44:15.2955648Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:332985fd4830584b0356f0bf28500f5b951f7ae1fb0e0b5d774c264e28a900e3",
"ResolvConfPath": "/var/lib/docker/containers/cc506e95df8788349090b310bfa6965b56dbb9e218efe4a9024eb2f502a2d2f2/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/cc506e95df8788349090b310bfa6965b56dbb9e218efe4a9024eb2f502a2d2f2/hostname",
"HostsPath": "/var/lib/docker/containers/cc506e95df8788349090b310bfa6965b56dbb9e218efe4a9024eb2f502a2d2f2/hosts",
"LogPath": "/var/lib/docker/containers/cc506e95df8788349090b310bfa6965b56dbb9e218efe4a9024eb2f502a2d2f2/cc506e95df8788349090b310bfa6965b56dbb9e218efe4a9024eb2f502a2d2f2-json.log",
"Name": "/determined_aryabhata",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "host",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/a802a922e08dd98e4dcebea8253d2457393aa5380ba31698087ebab7c20c7420-init/diff:/var/lib/docker/overlay2/7fd10d3a3749cfbcfb8ba4bffbe4d5ec9b70c0244f18d8bcbc10e50526fa2836/diff:/var/lib/docker/overlay2/a951e71a24b2c5635f34fbac57fe02e902ffa55928854bd63918c3a0eac8bd6a/diff:/var/lib/docker/overlay2/67defaf9804e20dbe3bb9b06a68301b527cebf5ad15103d129b564b4678f65eb/diff:/var/lib/docker/overlay2/7e88aebe633878bdd3fe36eb842259d1e898f64fd6937a47ac7b32cb77958fe0/diff:/var/lib/docker/overlay2/61c831913d4448f0efa8b78852181b45c993aa6d5d6b1d7b01e85f936121ab4d/diff:/var/lib/docker/overlay2/dc34279b6529ec9d0123de5a46520de90775fe9ad0d87f8e8a572085df7bf3d3/diff",
"MergedDir": "/var/lib/docker/overlay2/a802a922e08dd98e4dcebea8253d2457393aa5380ba31698087ebab7c20c7420/merged",
"UpperDir": "/var/lib/docker/overlay2/a802a922e08dd98e4dcebea8253d2457393aa5380ba31698087ebab7c20c7420/diff",
"WorkDir": "/var/lib/docker/overlay2/a802a922e08dd98e4dcebea8253d2457393aa5380ba31698087ebab7c20c7420/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "cc506e95df87",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"5000/tcp": {}
},
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [
"PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
您无法看到docker run,您可以检查如下所示;
version: "3.8"
services:
pyimg:
build: .
ports:
- 5000:5000
volumes:
- $HOME/Documents/qts:/home/docker/qts
command:
- /bin/bash
- -c
- sleep 60
用docker ps找到你的容器ID比;
docker exec -it ID /bin/bash
和
ls
问题内容: 嗨,我只是简单地尝试在www.example.com上获取h1标签,该标签显示为“ Example Domain”。该代码适用于http://www.example.com,但不适用于https://www.exmaple.com。我该如何解决这个问题?谢谢 问题答案: PhantomJSDriver不支持(所有)DesiredCapabilities。 你会需要: 记录在这里:htt
所以我使用这种方法写入文件,它在windows上运行完全正常,但在mac上运行时,它会创建文件,但它们是空的。 我知道数据是正确的,因为它打印正确。感谢您的任何帮助,这真的让我绊倒了。
我有一个简单的类,在下面编译时,它会正确地自动装箱整数,但是,对于我的布尔值,它无法这样做,它坚持我应该将参数更改为布尔值。我使用的是JDK1.8,否则编译器会抱怨整数转换。我看不出我做错了什么?所有包装器类都可以开箱即用,或者我是这么想的? 自动装箱不是一个双向过程吗?
更新:似乎用户代理并不是某些主机提供HTML所需的唯一标头,我还必须添加“accepts”标头,最终这为我解决了许多主机的问题: 我试图使用Guzzle来检索一些网站,但收到了403禁止错误(当它们在浏览器中工作正常时),我怀疑这是由于主机禁止了非标准的用户代理。为了解决这个问题,我试图在Guzzle中设置用户代理来模仿浏览器,但是我找不到任何有效的方法。我可以浏览网站,也可以使用WGET和CUR
我编写了以下代码来禁用ChromePDF查看器,以便在Chrome打开链接时,PDF文件可以在C:\下载文件夹中自动下载。 不幸的是,我相信PDF查看器没有被正确禁用。以下是我打开PDF url时使用此代码得到的结果: 有没有其他解决方案可以在Chrome中自动下载文件?
列名称的类型为int[] 上述查询适用于postgresql,但不适用于hsqldb,甚至适用于sql 尝试的hsqldb版本:2.2.9和2.3.0 在hsqldb中工作的sql是从table_name中选择x,unnest(column_name)y(x)x和y不是该表的列。