我有一个任务是在Vagrant Box(centos / 7)中创建一些Docker容器,但是我遇到了“vagrant up”执行的问题。
在vagrant实例中,我正在使用docker-compose来启动服务。
这是我在调用docker-compose时得到的错误:
> ==> default: [Provisioning] Bring up Docker Containers
> ==> default: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
> ==> default:
> ==> default: If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
如果我检查了vagrant实例,我可以看到docker正在运行,而且我的用户是docker组的一部分
c:\temp\vagrant\kpi-engine>vagrant ssh
[vagrant@localhost ~]$ ps aux | grep docker
root 425 0.1 4.6 496652 23152 ? Ssl 09:54 0:00 /usr/bin/dockerd
root 428 0.0 1.0 265176 5360 ? Ssl 09:54 0:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim do
cker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc
vagrant 1363 0.0 0.1 112652 972 pts/0 S+ 09:55 0:00 grep --color=auto docker
[vagrant@localhost ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[vagrant@localhost ~]$ grep vagrant /etc/group
vagrant:x:1000:vagrant
docker:x:992:vagrant
但是,如果我在“vagrant up”之后运行“vagrant provision”,那么一切都会在Docker中成功运行。
==> default: [Provisioning] Clone repositories
==> default: fatal: destination path 'kpi_data' already exists and is not an empty directory.
==> default: [Provisioning] Bring up Docker Containers
==> default: Creating network "vagrant_default" with the default driver
==> default: Creating volume "vagrant_mongo_db" with default driver
==> default: Creating volume "vagrant_maria_db" with default driver
==> default: Pulling mariadb (docker-registry.ptk02.ipaccess.com/mariadb:latest)...
==> default: latest: Pulling from mariadb
==> default: Digest: sha256:d17cfbf8e7e9b9ed79f2de17125a01f66f350ddf5bcdd8b62da20634cfa0b425
==> default: Status: Downloaded newer image for docker-registry.ptk02.ipaccess.com/mariadb:latest
==> default: Pulling mongo (docker-registry.ptk02.ipaccess.com/mongo:latest)...
==> default: latest: Pulling from mongo
==> default: Digest: sha256:4059a5c7c1f7d44a0ea3c1f8bda0e240f74f8cf16d6cc08e81d0fbc59b475553
==> default: Status: Downloaded newer image for docker-registry.ptk02.ipaccess.com/mongo:latest
==> default: Creating mongo
==> default: Creating mariadb
使用vagrant provisioner
安装Dockerconfig.vm.provision :docker
我用--debug跑了“流浪汉”,但它没有提供更多的见解。
关于可能出现什么问题的任何想法。