为了跟踪docker-compose使用的卷,我喜欢使用命名卷.这适用于"普通"卷
version: 2
services:
example-app:
volume:
-named_vol:/dir/in/container/volume
volumes:
named_vol:
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何在安装本地主机时使其工作.我正在寻找类似的东西:
version: 2
services:
example-app:
volume:
-named_homedir:/dir/in/container/volume
volumes:
named_homedir: /c/Users/
Run Code Online (Sandbox Code Playgroud)
要么
version: 2
services:
example-app:
volume:
-/c/Users/:/home/dir/in/container/ --name named_homedir
Run Code Online (Sandbox Code Playgroud)
这是以任何可能的方式,还是我坚持使用已安装的匿名卷?
我正在使用此链接制作一些docker-compose yml文件.在这个配置中,驱动程序的含义是什么:本地顶级卷?
volumes:
esdata1:
driver: local
esdata2:
driver: local
Run Code Online (Sandbox Code Playgroud) 我正在尝试在docker容器中运行postgresql,但当然我需要让我的数据库数据是持久的,所以我试图使用仅数据容器暴露卷来存储数据库在这个地方.
所以,我的数据容器有这样的Dockerfile:
FROM ubuntu
# Create data directory
RUN mkdir -p /data/postgresql
# Create /data volume
VOLUME /data/postgresql
Run Code Online (Sandbox Code Playgroud)
我运行的是:
docker run --name postgresql_data lyapun/postgresql_data true
Run Code Online (Sandbox Code Playgroud)
在我的postgresql.conf中我设置:
data_directory = '/data/postgresql'
Run Code Online (Sandbox Code Playgroud)
然后我以这样的方式运行我的postgresql容器:
docker run -d --name postgre --volumes-from postgresql_data lyapun/postgresql
Run Code Online (Sandbox Code Playgroud)
我得到了:
2014-07-04 07:45:57 GMT FATAL: data directory "/data/postgresql" has wrong ownership
2014-07-04 07:45:57 GMT HINT: The server must be started by the user that owns the data directory.
Run Code Online (Sandbox Code Playgroud)
如何处理这个问题?我搜索了很多关于使用带有docker卷的postgresql的信息,但我没有找到任何东西.
谢谢!
我在 gradle 容器中为我的 selenium 测试生成了报告,我正在尝试将文件从 docker 容器复制到本地主机。作为一种解决方法,我使用 docker cp 将文件从容器复制到我的本地,并且可以正常工作。如何使用 docker-compose 卷实现它。
下面是我的 docker-compose.yml
version: "3 "
services:
selenium-hub:
image: selenium/hub
container_name: selenium-hub_compose
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome-debug
container_name: selenium-chrome
depends_on:
- selenium-hub
ports:
- "5900"
environment:
- http_proxy=http://x.x.x.x:83
- https_proxy=http://x.x.x.x:83
- HUB_HOST=selenium-hub
- HUB_PORT=4444
gradle:
image: gradle:jdk8
container_name: selenium-gradle
build:
context: .
dockerfile: dockerfile
Run Code Online (Sandbox Code Playgroud)
我运行命令docker-compose up-> 它运行 selenium 测试并在容器中生成报告。
任何人都可以帮忙吗?
我想在Windows系统上部署我的应用程序。我最近(昨天)安装DockerToolbox-1.12.4在Windows 10上。这为我提供了一个新终端。当我尝试使用部署我的项目时docker-compose up --build,我收到以下消息:
ERROR: for myservice Cannot create container for myService: create
\var\run\docker.socker: "\\var\\run\\docker.sock" includes invalid
characters for a local volume name, only "[...][...]" are allowed 该服务包含 另一个错误是:
ERROR: for service2 Cannont create container for service service2:
Invalid bind mount spec
"c:\\Users\\username\\Desktop\\project\\service2:/home/docker/code:rw"
Encountered errors while bringing up projet。我的项目有4个容器,而其他2个没有错误消息。这是我的docker-compose.yml文件:
version: '2'
services:
s1:
build: ../images/s1
ports:
- "5000:5000"
links: ["s2"]
s2:
build: ../images/s2
ports:
- "9000:9000"
service2:
build: ../images/service2
ports:
- "4000:4000"
volumes:
- …Run Code Online (Sandbox Code Playgroud)