Docker/Installing
From charlesreid1
This page is about installing the Docker platform.
For more about installing Docker containers see Docker/Dockerhub.
Contents
Installing
Docker has great documentation on getting up and running: https://docs.docker.com/
Docker also provides several examples of docker-izing an app: https://docs.docker.com/engine/examples/
Ubuntu Linux
You can get docker running on many virtual hosting services.
Links:
- Linode supports docker: https://blog.linode.com/2014/01/03/docker-on-linode/
- They offer installation guides for different distributions: https://docs.docker.com/engine/installation/linux/#install-using-the-repository
- Guide to installing Docker on Ubuntu Linux: https://docs.docker.com/engine/installation/linux/ubuntulinux/
We can get Docker's repositories added to Ubuntu's apt-get and pull the latest version of docker from there. This is a much better way to keep things secure and up-to-date than the method of distributing pointers to crusty old software in the operating system. Start by installing dependencies:
$ sudo apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
Add the Docker repo's GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify fingerprint starts with 9DC8:
$ sudo apt-key fingerprint 0EBFCD88
Set up the stable repository:
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
Install docker by updating package index and running install:
$ sudo apt-get update $ sudo apt-get install -y docker-ce
Test it out:
$ sudo docker run hello-world
If all goes well, you'll see this:
$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 78445dd45222: Pull complete Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/
Errors
When I added Docker's repos to my aptitude following the instructions above, I kept seeing 403 errors from docker's repo when I ran apt-get update:
$ sudo apt-get update ... W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/wily/stable/binary-amd64/Packages HttpError403
Yuck. Others have had this issue too. [1]
Resolving
Resolved the problem by visiting their apt repos with a browser and manually downloading/installing the .deb file.
Start with the name of your release:
$ lsb_release -c Codename: wily
Now navigate to their aptitude repositories in your browser: https://apt.dockerproject.org/repo/pool/main/d/docker-engine/
Find the deb file that corresponds to your install and copy the link.
$ wget <link to .deb file>
Now you can install it (you probably need to be sudo):
$ dpkg -i docker-engine_1.9.1-0~wily_amd64.deb Selecting previously unselected package docker-engine. (Reading database ... 142272 files and directories currently installed.) Preparing to unpack docker-engine_1.9.1-0~wily_amd64.deb ... Unpacking docker-engine (1.9.1-0~wily) ... Setting up docker-engine (1.9.1-0~wily) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for systemd (225-1ubuntu9.1) ... Processing triggers for man-db (2.7.4-1) ...
Mac
You can run docker on Mac: https://docs.docker.com/docker-for-mac/
Docker on Linux Without Sudo
To modify Docker so it runs on Linux without requiring the use of the sudo command, create a docker group:
groupadd docker usermod -a -G docker username
That's it - boom - all done.
Log out and log back in. Now you can run docker without sudo:
$ docker run hello-world # look ma, no sudo
Testing Out Installation
Up and Running
post installation info: https://docs.docker.com/engine/installation/linux/linux-postinstall/#upstart
Test
Test you are up and running with a working install of docker:
$ docker --version Docker version 17.03.0-ce, build 60ccb22 $ docker-compose --version docker-compose version 1.11.2, build dfed245 $ docker-machine --version docker-machine version 0.10.0, build 76ed2a6 $ docker version Client: Version: 1.9.1 API version: 1.21 Go version: go1.4.2 Git commit: a34a1d5 Built: Fri Nov 20 13:20:08 UTC 2015 OS/Arch: linux/amd64 Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Hello world
$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from hello-world 50a54e1f9180: Pull complete 7a5a2d73abce: Pull complete Digest: sha256:7820f4620e6cf3e795643fac2f6b09e7fd0a29e7e5c4eee6aac9ba0bedca158c Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/
web server
docker run -d -p 80:80 --name webserver nginx
What's Next
See Docker/Dockerhub for how to get containers from docker hub.
See Docker/Dockerfiles for making your own docker containers.
See Docker/Basics for the basics about running with docker.
docker notes on the virtual microservice container platform
Installing the docker platform: Docker/Installing Docker Hello World: Docker/Hello World
Creating Docker Containers: Getting docker containers from docker hub: Docker/Dockerhub Creating docker containers with dockerfiles: Docker/Dockerfiles Managing Dockerfiles using git: Docker/Dockerfiles/Git Setting up Python virtualenv in container: Docker/Virtualenv
Running docker containers: Docker/Basics Dealing with volumes in Docker images: Docker/Volumes Removing Docker images: Docker/Removing Images Rsync Docker Container: Docker/Rsync
Networking with Docker Containers:
|
docker pods pods are groups of docker containers that travel together
Docker pods are collections of Docker containers that are intended to run in concert for various applications.
Wireless Sensor Data Acquisition Pod The wireless sensor data acquisition pod deploys containers This pod uses the following technologies: Stunnel · Rsync · Apache · MongoDB · Python · Jupyter (numerical Python stack)
Deep Learning Pod This pod utilizes the following technologies: Python · Sklearn · Jupyter (numerical Python stack) · Keras · TensorFlow
|