You do not need to run docker commands as sudo when you use boot2docker , since every command passed to boot2docker VM runs as root by default.
You see an error when you work as sudo , because sudo does not have the DOCKER_HOST env set, only your user does.
You can confirm this by doing:
$ env
Then a
$ sudo env
We are looking for DOCKER_HOST in each output.
As for the docker file that runs your script, there might be something like this for you:
Dockerfile
FROM busybox
Then you can run:
docker build -t your-image-name:your-tag .
This will create your docker image, which you can see by doing:
docker images
Then, to start the container, you can do the following:
docker run your-image-name:your-tag
This start command will start the container from the image created with your Dockerfile and your build, and then Dockerfile when script.sh completes.
Chris McKinnel Aug 18 '14 at 22:25 2014-08-18 22:25
source share