AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 757175
Accepted
gogasca
gogasca
Asked: 2016-02-15 14:57:59 +0800 CST2016-02-15 14:57:59 +0800 CST 2016-02-15 14:57:59 +0800 CST

Docker 撰写卷无效字符

  • 772

无法使用 docker-compose up 启动容器

Docker version 1.9.1, build a34a1d5

Dockerfile

FROM ubuntu

# File Author / Maintainer
MAINTAINER Parzee [email protected]

# Install Components.

# Update the repository
ENV LANG en_US.UTF-8
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN locale-gen en_US en_US.UTF-8
# Install necessary tools
RUN apt-get install -y nano vim wget dialog net-tools
RUN apt-get install lighttpd -y
RUN apt-get install php5-common php5-cgi php5 -y
RUN lighty-enable-mod fastcgi-php
RUN update-rc.d -f lighttpd disable
RUN mkdir -p /usr/local/src/imbue/application/imbue/utils/security/des

ADD lighttpd.conf /etc/lighttpd/

VOLUME ["/var/log/lighttpd"]

RUN ls -al /etc/lighttpd/lighttpd.conf

RUN /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

EXPOSE 8083

码头工人-compose.yml

lighttpd:
  image: parzee/lighttpd
  ports: 
    - "8083:8083"
  volumes:
    - volumes/log:/var/log/lighttpd 

当我运行时:

docker run -h lighttpd -p 8083:8083 -d -v `pwd`/volumes/log:/var/log/lighttpd -t parzee/lighttpd

我的容器启动正常,但是使用docker-compose up我收到以下错误:

Creating lighttpd_lighttpd_1
ERROR: volumes/log includes invalid characters for a local volume name, only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed

这是文件结构:

.
├── docker-compose.yml
├── Dockerfile
├── lighttpd.conf
└── volumes
    ├── etc
    │   └── lighttpd
    │       └── lighttpd.conf
    └── log

4 directories, 4 files
ubuntu
  • 2 2 个回答
  • 3438 Views

2 个回答

  • Voted
  1. Best Answer
    hookenz
    2016-02-15T15:05:30+08:002016-02-15T15:05:30+08:00

    yaml 对 docker compose 非常挑剔。确保路径是绝对的(对于主机端)并且不包含尾随空格。

    "- volumes/log:/var/log/lighttpd "
    

    应该

    "- /host/path/volumes/log:/var/log/lighttpd"
    

    没有引号!我把它们放进去是为了突出这个问题。

    如果您确实需要相对路径,请考虑使用起重机而不是 docker-compose。

    • 3
  2. kenorb
    2019-03-12T14:11:47+08:002019-03-12T14:11:47+08:00

    要在部分中使用相对路径volumes,您必须添加./,例如

      volumes:
        - ./volumes/log:/var/log/lighttpd
    

    或者从命令行,例如:

    docker run -v $PWD/volumes/log:/var/log/lighttpd ...
    
    • 0

相关问题

  • 无法通过 Ubuntu VPN 访问外部网络

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

  • VirtualBox 上 Ubuntu 的访客优化技巧 [关闭]

  • 外部硬盘上的 virtualbox 虚拟硬盘驱动器(Vista 主机上的 ubuntu 客户机)

  • 如何在 Ubuntu 上挂载 LVM 分区?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve