##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes below
-->
```
2.4.1.0
```
##### OS / ENVIRONMENT
centos 7 in vagrant
##### SUMMARY
# install docker script
```
function docker_install() {
echo "docker install"
if [ ${sysOS} == "Linux" ]
then
if [ ! -f /tmp/install_docker_flag ]; then
rm -f /var/run/docker.sock
tar zxvf ${DOCKER_ENGINE_DIR}/${DOCKER_FILE}.tar.gz
mv ${DOCKER_FILE}/* /usr/local/bin
tar zxvf ${DOCKER_ENGINE_DIR}/${DOCKER_COMPOSE_FILE}.tar.gz
mv ${DOCKER_COMPOSE_FILE}/* /usr/local/bin/docker-compose
# echo '{"insecure-registries":["'${PRIVATE_REGISTRY}'"]}' >
/etc/docker/daemon.json
mkdir -p /etc/docker
echo '{"registry-mirrors": ["http://'${PRIVATE_REGISTRY}'"],
"insecure-registries" : [ "'${PRIVATE_REGISTRY}'"] }' >
/etc/docker/daemon.json
rm -fr ${DOCKER_FILE}
rm -fr ${DOCKER_COMPOSE_FILE}
echo 'success' > /tmp/install_docker_flag
else
echo 'already installed docker'
fi
else
echo "this is "${sysOS}
exit 1
fi
}
```
This just copy dockerd binary to /usr/local/bin
# start docker
```
- name: start docker
shell: /usr/local/bin/dockerd >/dev/null 2>&1 &
# command: sh {{ start_docker_script }}
```
# logs
1. But script `docker load < ${DOCKER_IMAGES_DIR}/${packages['registry']}`
in `TASK [registry : Install registry]` , complain docker not found.
2. After ansible failed, I enter that vm, confirmed dockerd was not
running.
3. I also tried to start `dockerd ` by a script , nether work.
4. I enter vagrant and have confirmed all files copied successful .
5. In vagrant vm, directly run `/usr/local/bin/dockerd >/dev/null 2>&1
&` is working
```
TASK [common : Install docker]
********************************************************************************
changed: [host02]
changed: [host01]
TASK [common : start docker]
**********************************************************************************
changed: [host02]
changed: [host01]
PLAY [registry]
***********************************************************************************************
TASK [Gathering Facts]
****************************************************************************************
ok: [host01]
TASK [registry : Install registry]
****************************************************************************
fatal: [host01]: FAILED! => {
"changed": true,
"cmd": [
"sh",
"/data/bidspy-yychen/dist/scripts/install_registry.sh"
],
"delta": "0:00:00.045283",
"end": "2017-11-10 03:28:33.555247",
"failed": true,
"rc": 125,
"start": "2017-11-10 03:28:33.509964"
}
STDOUT:
/data/bidspy-yychen/dist/scripts
/data/bidspy-yychen/dist
STDERR:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the
docker daemon running?
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the
docker daemon running?
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
Is the docker daemon running?.
See 'docker run --help'.
MSG:
non-zero return code
```
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/55b059f4-5f99-432b-b556-63546f45ffb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.