How to do it...

  1. To install Docker on your Ubuntu 16.04 machine, add the GPG key for the official Docker repository to the system:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  1. Then add the Docker repository to APT sources:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  1. Next, update the package database with the Docker packages from the newly added repository:
$ sudo apt-get update
$ sudo apt-get install docker-ce
  1. Add your user to the docker group:
$ sudo usermod -aG docker ${USER}
$ su - ${USER}
  1. Finally, test run Docker by running the hello-world container:
$ docker run hello-world
  1. To run a docker-toaster instance, we will first create a directory in our host machine for the docker container to store the builds:
$ mkdir /opt/yocto/docker-toaster
  1. We can then instruct Docker to run the crops/toaster container and point its /workdir directory to the local directory we just created:
$ docker run -it --rm -p 127.0.0.1:18000:8000 -v /opt/yocto/docker-toaster:/workdir crops/toaster 
If you see the following error:

Refusing to use a gid of 0
Traceback (most recent call last):
  File "/usr/bin/usersetup.py", line 62, in <module>
    subprocess.check_call(cmd.split(), stdout=sys.stdout, stderr=sys.stderr)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', 'restrict_groupadd.sh', '0', 'toasteruser']' returned non-zero exit status 1

Make sure the /opt/yocto/docker-toaster directory was created before running Docker and is not owned by root. If you don't create it beforehand, Docker will do it with the root user and the setup will fail as above.

See https://github.com/crops/poky-container/issues/20.
Note that you can replace the 127.0.0.1 above with an IP address that is externally accessible if you are running Docker on a different machine.
  1. You can now detach from the docker container with Ctrl + P Ctrl + Q. Check the container is still running with:
$ docker ps
  1. You can now access the Toaster web interface at http://127.0.0.1:18000.
  2. The docker container can be stopped with the following command:
$ docker stop <container-id>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset