ubuntu - Running Docker Commands with a bash script inside a container -


i'm trying automate deployment webhooks docker hub based on this tutorial. 1 container runs web app on port 80. on same host run container listens post requests docker hub, triggering host update webapp image. post request triggers bash script looks this:

echo pulling... docker pull my_username/image docker stop img docker rm img docker run --name img -d -p 80:80 my_username/image 

a test payload succesfully triggers script. however, container logs following complaints:

pulling... app/deploy.sh: line 4: docker: command not found ... app/deploy.sh: line 7: docker: command not found 

it seems bash script not access host implicitly. how proceed?

stuff tried did not work: when firing listener container added host ip based on docs:

hostip=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print\$2}' | cut -d / -f 1` docker run --name listener --add-host=docker:${hostip} -e token="test654321" -d -p 5000:5000 mjhea0/docker-hook-listener 

similarly, substituted --add-host command --add-host=dockerhost:$(ip route | awk '/docker0/ { print $nf }') based on this suggestion.

neither docker binary nor docker socket present in container default (why it?).

you can solve mounting binary , socket host when start container e.g:

$ docker run -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock debian docker --version docker version 1.7.0, build 0baf609 

you seem bit confused how docker works; i'm not sure mean "access host implicitly" or how think work. think of container isolated , ephemeral machine, separate host, fast vm.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -