我一直在尝试为我的码头工作者做一个备份系统,一切都适用于数据库容器,除了网络服务器在Nginx下运行的容器。我一直在环顾四周,似乎我不是唯一一个有这个问题的人,但是我找不到解决办法。
步骤:
# docker load -i /path/to/backup-image.tar
# docker run \
> -v $(pwd)/volumes/home/project/project-git-repo/project-docker/volumes/php-conf/custom-php.ini:/usr/local/etc/php/conf.d/custom-php.ini \
> -v $(pwd)/volumes/home/project/project-git-repo/project-docker/volumes/php-conf/opcache-recommended.ini:/usr/local/etc/php/conf.d/opcache-recommended.ini \
> -v $(pwd)/volumes/home/project/project-git-repo/project-docker/volumes/wp-content:/var/www/html \
> -v $(pwd)/volumes/tmp/html/.well-known:/var/www/html/.well-known \
> --name websrv project_backup_tmp
这最后一个命令输出:
container_linux.go:262: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:57: mounting \\\"/tmp/project_restore/docker/7aa016ba40e9/volumes/home/project/project-git-repo/project-docker/volumes/php-conf/custom-php.ini\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/b23066c3007d106ae9364ca4e2603e4d5a3e63a0f47d2669ca6580be735adb06\\\" at \\\"/var/lib/docker/aufs/mnt/b23066c3007d106ae9364ca4e2603e4d5a3e63a0f47d2669ca6580be735adb06/usr/local/etc/php/conf.d/custom-php.ini\\\" caused \\\"not a directory\\\"\""
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:57: mounting \\\"/tmp/project_restore/docker/7aa016ba40e9/volumes/home/project/project-git-repo/project-docker/volumes/php-conf/custom-php.ini\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/b23066c3007d106ae9364ca4e2603e4d5a3e63a0f47d2669ca6580be735adb06\\\" at \\\"/var/lib/docker/aufs/mnt/b23066c3007d106ae9364ca4e2603e4d5a3e63a0f47d2669ca6580be735adb06/usr/local/etc/php/conf.d/custom-php.ini\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
ERRO[0001] error waiting for container: context canceled
以下是我的docker info
:
Containers: 14
Running: 1
Paused: 0
Stopped: 13
Images: 79
Server Version: 17.06.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 184
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-83-generic
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 19.59GiB
Name: rajiska-server
ID: 4YFX:52ZF:QKGV:IMY4:6PP4:6P33:JXGT:QHJW:MZTI:QVVX:YU77:ZGR6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
答案 0 :(得分:0)
我遇到了同样的问题,通常是尝试将主机上的文件挂载到另一台机器或VM中运行的容器。
因此,如果您运行的容器位于VirtualBox VM或本地之外的其他计算机上,则必须找到另一种同步目录的方法。
但是,如果您使用docker-machine
设置VirtualBox VM,它通常会将/home
目录安装到创建的VM上的/hosthome
。
例如,如果您的项目位于您的主目录中,那么它可以像这样安装:
docker run -v /hosthome/USERNAME/PROJECT:/path/on/container imagename
其中:
USERNAME
是您在主机上的用户名PROJECT
是主机上项目目录的名称答案 1 :(得分:0)
设置elk时出现同样的错误: 错误的原因是我在我的计算机中使用大写字母c手动命名了配置文件,而在docker中搜索home/imusebe/elastdocker/elasticsearch/config/elasticsearch.yml。
设置这个可以让事情运行起来。