Docker: Difference between revisions
Line 22: | Line 22: | ||
* OS containers: LXC, [https://openvz.org/Main_Page OpenVZ], Linux VServer, BSD Jails and Solaris zones. The container acts as VPS. | * OS containers: LXC, [https://openvz.org/Main_Page OpenVZ], Linux VServer, BSD Jails and Solaris zones. The container acts as VPS. | ||
* App containers: Docker, Rocket. The container acts as an application. | * App containers: Docker, Rocket. The container acts as an application. | ||
== Current release version == | |||
* https://docs.docker.com/release-notes/docker-ce/ (stable release) | |||
* https://github.com/docker/docker-ce/releases (stable & pre-release, could be newer than the above release-notes) | |||
== Ubuntu == | == Ubuntu == |
Revision as of 18:53, 29 December 2017
Official web page http://docker.io.
Docker is both a client and a server: the server is a daemon that runs on Linux. The normal approach was that you used docker on the same server the daemon was running on - however it was possible to connect the docker client to a remote docker daemon.
Installation
Which OS to install?
- Which OS Is Best for Docker? Here’s How to Decide
- Container OS Comparison
- CoreOS. See 12 Best Linux Server Operating Systems and Who Should Use Them
- RancherOS
- Snappy Ubuntu Core
- RedHat Project Atomic
- Mesosphere DCOS
- VMware Photon. Photon Could Be Your New Favorite Container OS
OS containers vs application containers
- https://blog.risingstack.com/operating-system-containers-vs-application-containers/
- OpenVZ Versus Docker And More On Linux System Container Platforms
- Docker vs OpenVZ
Differences:
- OS containers: LXC, OpenVZ, Linux VServer, BSD Jails and Solaris zones. The container acts as VPS.
- App containers: Docker, Rocket. The container acts as an application.
Current release version
- https://docs.docker.com/release-notes/docker-ce/ (stable release)
- https://github.com/docker/docker-ce/releases (stable & pre-release, could be newer than the above release-notes)
Ubuntu
To use docker without sudo, follow the instruction here.
# Add the docker group if it doesn't already exist. sudo groupadd docker # Add the connected user "${USER}" to the docker group. sudo gpasswd -a ${USER} docker # Restart the Docker daemon: sudo service docker restart # If you are on Ubuntu 14.04 and up use docker.io instead: sudo service docker.io restart # log out/in to activate the changes to groups.
CentOS
https://docs.docker.com/engine/installation/linux/docker-ce/centos/
Boot2Docker
For Windows and OS operation systems, we have to use Boot2Docker. Boot2Docker is a local virtual machine with its own network interface and IP address. To find the Boot2Docker IP address you can check the value of the DOCKER_HOST environment variable. You're be prompted to set this variable when you start or install Boot2Docker the first time. You can find the IP address by running boot2docker ip command.
Note that since Windows and OS X don't share a file system as Linux, the command 'docker run' with '-v' flag to mount a local directory into a Docker container will not work with Boot2Docker release prior to 1.3. The support for volumes is now available for OS X but is not yet present for Windows with the release of Boot2Docker 1.3.
Windows
Docker can be run on Windows 10 Pro as a native application; see
- https://docs.docker.com/engine/installation/windows/.
- Run Linux containers on Windows & Chinese translation
The information below is based on running Docker on Windows 7.1 and 8. Your processor needs to support hardware virtualization.
- Windows Installer includes msys-git, Virtualbox, Boot2Docker-cli management tool and Boot2Docker ISO.
- Installation instruction for Windows OS. It will install Boot2Docker management tool with the boot2docker iso (based on Tiny Core Linux), Virtualbox and MYSYS-git UNIX tools.
- Docker needs Admin right to be installed. However, Virtualbox can be installed by user's account.
- If the installer detects a version of VirtualBox installed, the VirtualBox checkbox will not be checked by default (Windows OS). The VirtualBox cannot be used anymore after updating my VB from 4.3.18 to 4.3.20. The error may be related to Windows update according to Virtualbox forum.
Error in supR3HardenedWinReSpawn
- Note that boot2docker cannot be installed/run inside a Windows guest machine. See this post and my Virtualbox wiki here. If we try to launch boot2docker-vm from Virtualbox, we will see a message "This kernel requires an x86-64 CPU, but only detected an i686 CPU."
- After I switch back to an old version of virtualbox, every thing works again. I can even install Docker successfully.
- Boot2Docker Start icon cannot be run directly because Notepad++ will automatically open it. A possible solution is to go to control panel and change default program for .sh file from Notepad++ to C:\Program Files (x86)\Git\bin\bash.exe.
- The above step does not work well since a terminal appears and disappears quickly.
- A working approach is to open Git Bash from Start menu. And run /c/Program Files/Boot2DockerforWindows/start.sh (or boot2docker start or boot2docer init)
- A new VM called 'boot2docker-vm' will be created (we can open VirtualBox Manager to check). But I got an error error in run: Failed to start machine "boot2docker-vm" (run again with -v for details). The VM has an error on Network>Adapter2>VirtualBox Host-Only Ethernet Adapter #2. So I open the setting of <boot2docker-vm>, go to Network > Adapter 2 and change the dropdown list of Name from VirtualBox Host-Only Ethernet Adapter #2 to VirtualBox Host-Only Ethernet Adapter.
- Now it works either I directly click boot2docker-vm VM from VB Manager or use the command start.sh from Git Bash.
$ # boot2docker is in the PATH variable, so there is not need to cd to the folder. $ boot2docker start initializing... Virtual machine boot2docker-vm already exists starting... Waiting for VM and Docker daemon to start... ........o Started. Writing c:\Users\brb\.boot2docker\certs\boot2docker-vm\ca.pem Writing c:\Users\brb\.boot2docker\certs\boot2docker-vm\cert.pem Writing c:\Users\brb\.boot2docker\certs\boot2docker-vm\key.pem Docker client does not run on Windows for now. Please use "c:\Program files\Boot2Docker for Windows\boot2docker.exe" ssh to SSH into the VM instead. 192.168.56.101 connecting... ## . ## ## ## == ## ## ## ## === /""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\______/ _ _ ____ _ _ | |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __ | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__| | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ | |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_| Boot2Docker version 1.4.1, build master : 86f7ec8 - Tue Dec 16 23:11:29 UTC 2014 Docker version 1.4.1, build 5bc2ff8 docker@boot2docker:~$ docker Usage: docker [OPTIONS] COMMAND [arg...] A self-sufficient runtime for linux containers. Options: --api-enable-cors=false Enable CORS headers in the remote API -b, --bridge="" Attach containers to a pre-existi ng network bridge ... Run 'docker COMMAND --help' for more information on a command. docker@boot2docker:~$ docker run hello-world Unable to find image 'hello-world:latest' locally hello-world:latest: The image you are pulling has been verified 511136ea3c5a: Pull complete 31cbccb51277: Pull complete e45a5af57b00: Pull complete 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. (Assuming it was not already locally available.) 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 For more examples and ideas, visit: http://docs.docker.com/userguide/ docker@boot2docker:~$ ls boot2docker, please format-me docker@boot2docker:~$ pwd /home/docker docker@boot2docker:~$ ls / bin/ dev/ home/ lib/ mnt/ proc/ run/ sys/ usr/ c/ etc/ init linuxrc opt/ root/ sbin/ tmp var/ docker@boot2docker:~$ docker run hello-world 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. (Assuming it was not already locally available.) 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 For more examples and ideas, visit: http://docs.docker.com/userguide/ docker@boot2docker:~$ docker@boot2docker:~$ docker@boot2docker:~$ docker@boot2docker:~$ docker run -it ubuntu bash Unable to find image 'ubuntu:latest' locally ubuntu:latest: The image you are pulling has been verified 53f858aaaf03: Pull complete 837339b91538: Pull complete 615c102e2290: Pull complete b39b81afc8ca: Pull complete 511136ea3c5a: Already exists Status: Downloaded newer image for ubuntu:latest root@ea7e3289a01a:/# pwd / root@ea7e3289a01a:/# df -h Filesystem Size Used Avail Use% Mounted on rootfs 19G 269M 17G 2% / none 19G 269M 17G 2% / tmpfs 1005M 0 1005M 0% /dev shm 64M 0 64M 0% /dev/shm /dev/sda1 19G 269M 17G 2% /etc/hosts tmpfs 1005M 0 1005M 0% /proc/kcore root@ea7e3289a01a:/# ls bin dev home lib64 mnt proc run srv tmp var boot etc lib media opt root sbin sys usr root@ea7e3289a01a:/# exit exit docker@boot2docker:~$ pwd /home/docker docker@boot2docker:~$ ls boot2docker, please format-me docker@boot2docker:~$ exit [Press any key to exit] brb@NCI-01825357 /c/Program files/Boot2Docker for Windows $ boot2docker down brb@NCI-01825357 /c/Program files/Boot2Docker for Windows $ $ boot2docker --help Usage: c:\Program files\Boot2Docker for Windows\boot2docker.exe [<options>] <command> [<args>] Boot2Docker management utility. Commands: init Create a new Boot2Docker VM. up|start|boot Start VM from any states. ssh [ssh-command] Login to VM via SSH. save|suspend Suspend VM and save state to disk. down|stop|halt Gracefully shutdown the VM. restart Gracefully reboot the VM. poweroff Forcefully power off the VM (may corrupt disk image). reset Forcefully power cycle the VM (may corrupt disk image). delete|destroy Delete Boot2Docker VM and its disk image. config|cfg Show selected profile file settings. info Display detailed information of VM. ip Display the IP address of the VM's Host-only network. shellinit Display the shell commands to set up the Docker client. status Display current state of VM. download Download Boot2Docker ISO image. upgrade Upgrade the Boot2Docker ISO image (restart if running). version Display version information. Options: --basevmdk="": Path to VMDK to use as base for persistent partition --clobber=false: overwrite Docker client binary on boot2docker upgrade --dhcp=true: enable VirtualBox host-only network DHCP. --dhcpip=192.168.59.99: VirtualBox host-only network DHCP server address. .... -v, --verbose=false: display verbose command invocations. --vm="boot2docker-vm": virtual machine name. --waittime=300: Time in milliseconds to wait between port knocking retries during 'start' error in run: config error: pflag: help requested brb@NCI-01825357 /c/Program files/Boot2Docker for Windows
The big picture
start.sh docker run -it ubuntu bash Git Bash Git Bash ----------> boot2docker-vm -------------> ubuntu docker@boot2docker: <------- <---------- <------------- boot2docker down exit exit (shutdown boot2docker) (boot2docker-vm is still on) | | | boot2docker up (start boot2docker) | | boot2docker ssh (log into docker acct) | v boot2docker-vm docker@boot2docker
Increase boot2docker vmdk space
https://docs.docker.com/articles/b2d_volume_resize/
Install utilities in Boot2docker VM
http://blog.tutum.co/2014/11/05/how-to-use-docker-on-windows/
For example, to install cifs-utils,
wget http://distro.ibiblio.org/tinycorelinux/5.x/x86/tcz/cifs-utils.tcz tce-load -i cifs-utils.tcz
Mac
If you have Mac, you don't have to use boot2docker (iso & its management tool). You can use other Linux which comes with docker pre-installed. See this post.
Odroid
- See Odroid magazine 2015 January and 2015 February. Note that the current versions of Docker and Docker Hub are not aware of the architecture for which the image has been built. All standard images are intended for the x86 architecture, and the autobuild feature offered by the Docker registry is only available for x86.
GUI interface
Seagull
Kitematic
Run containers through a simple, yet powerful graphical user interface.
A Share your Shiny Apps with Docker and Kitematic!
Portainer
DockerUI (Deprecated, Development continues at Portainer)
A quick start:
1. Run:
docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock dockerui/dockerui
where -v means to bind mount a volume.
2. Open your browser to http://<dockerd host ip>:9000
Shipyard (retired)
- Managing Containers with Docker Shipyard
- Three alternatives:
Usage
Basics, docs, cheatsheet
- https://docs.docker.com/articles/basics/
- https://coderwall.com/p/2es5jw/docker-cheat-sheet-with-examples
- https://github.com/wsargent/docker-cheat-sheet
- How to use Docker in a practical way
- https://hackernoon.com/introduction-to-docker-a7d9e1f6c0b3#.tezit0hkq
- Docker快速入门
- Docker: The Fun and Easy Way
Note that we need sudo is needed unless it is on a Mac OS.
If docker cannot find an image, it will try to pull it from its repository.
$ sudo docker run -it ubuntu /bin/bash Unable to find image 'ubuntu' locally Pulling repository ubuntu 04c5d3b7b065: Download complete 511136ea3c5a: Download complete c7b7c6419568: Download complete 70c8faa62a44: Download complete d735006ad9c1: Download complete root@ec83b3ac878d:/#
Restart docker daemon
When I try the Chap5 > Continuous integration (Jenkins) of the Docker Book, I found I cannot stop/kill the container. See others' report here. The solution is to restart the docker daemon.
sudo service docker start
After that, I can stop and rm the container.
sudo docker stop jenkins sudo docker rm jenkins sudo docker ps -a
images vs containers
$ sudo docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE iman latest 6e0f5644b2fd About a minute ago 460.4 MB iman/touch latest 77b9ac5951c2 4 minutes ago 460.4 MB <none> <none> aaa75e64ddf0 5 weeks ago 188.3 MB ouruser/sinatra v2 ea8c9f407a8d 5 weeks ago 447 MB ubuntu 14.04 ed5a78b7b42b 5 weeks ago 188.3 MB ubuntu latest ed5a78b7b42b 5 weeks ago 188.3 MB eddelbuettel/docker-ubuntu-r add-r-devel-san 3c19d078c5d9 3 months ago 460.4 MB hello-world latest ef872312fe1b 4 months ago 910 B training/sinatra latest f0f4ab557f95 8 months ago 447 MB $ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8fbdbcdb5126 iman/touch:latest "/bin/bash" 2 minutes ago Exited (0) 2 minutes ago thirsty_engelbart dc9e82f2c00a eddelbuettel/docker-ubuntu-r:add-r-devel-san "/bin/bash" 9 minutes ago Exited (0) 3 minutes ago kickass_bardeen 532a90f36aa8 eddelbuettel/docker-ubuntu-r:add-r-devel-san "/bin/bash" 18 hours ago Exited (0) 18 hours ago happy_lalande 7634024ee0bf eddelbuettel/docker-ubuntu-r:add-r-devel-san "/bin/bash" 18 hours ago Exited (0) 18 hours ago insane_mclean 14034a9720cb eddelbuettel/docker-ubuntu-r:add-r-devel-san "/bin/bash" 18 hours ago Exited (0) 18 hours ago naughty_lumiere ca90954628db eddelbuettel/docker-ubuntu-r:add-r-devel-san "/bin/bash" 19 hours ago Exited (130) 18 hours ago sick_hawking 8bbdcb7c339f eddelbuettel/docker-ubuntu-r:add-r-devel-san "/bin/bash" 19 hours ago Exited (0) 19 hours ago modest_davinci e8e24f80f0dd aaa75e64ddf0 "/bin/sh -c 'apt-get 5 weeks ago Exited (100) 5 weeks ago berserk_hodgkin d41959e0eb55 aaa75e64ddf0 "/bin/sh -c 'apt-get 5 weeks ago Exited (100) 5 weeks ago jovial_curie b408c0e2805b aaa75e64ddf0 "/bin/sh -c 'apt-get 5 weeks ago Exited (100) 5 weeks ago lonely_tesla 72a551e4b492 ouruser/sinatra:v2 "/bin/bash" 5 weeks ago Exited (0) 5 weeks ago jolly_meitner 75fd6cc4658b training/sinatra:latest "/bin/bash" 5 weeks ago Exited (0) 5 weeks ago evil_yalow cc8886f5a02e training/sinatra:latest "/bin/bash" 5 weeks ago Exited (130) 5 weeks ago elegant_curie 0585e4f5fecd eddelbuettel/docker-ubuntu-r:add-r-devel-san "/bin/bash" 5 weeks ago Exited (0) 5 weeks ago elated_euclid brb@brbweb4:~/Downloads$
When we want to delete a container, we use the container's CONTAINER ID or NAME (last column output from docker ps -a). But when we want to delete an image, we use the image's REPOSITORY or IMAGE ID (2nd column output from docker images)
$ sudo docker rm thirsty_engelbart # iman/touch $ sudo docker rm dc9e82f2c00a # eddelbuettel/docker-ubuntu-r:add-r-devel-san $ sudo docker ps -a # check to see the container is gone now $ sudo docker rmi 6e0f5644b2fd $ sudo docker rmi iman/touch $ sudo docker images # check to see the images are gone now
A brief intro to docker virtualization
docker search --help docker search redis docker search -s 100 redis docker pull --help docker pull ubuntu # download all versions of ubuntu docker images # available local container images docker pull centos:latest docker run --help cat /etc/issue # look at the current distr name before running docker docker run -it centos:latest /bin/bash # create a container & execute as a sudo cat /etc/redhat-release yum cd /home touch temp.txt ls exit docker ps # current running processes docker ps -a # show all processes including closed docker restart c85850ed0e13 docker ps # container c85850ed0e13 is running docker attach c85850ed0e13 # log into the system ls /home exit docker ps -a docker rm c85850ed0e13 # delete the container
Note: Following the discussion, using attach can only launch one instance of shell. If we use exec, we can launch multiple instances.
sudo docker exec -i -t c85850ed0e13 bash #by ID or $ sudo docker exec -i -t loving_heisenberg bash #by Name
Docker Machine
Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands.
For example, the demo video of RancherOS used the docker-machine command to pull and run the RancherOS.
docker-machine create -d virtualbox --virtualbox-boot2docker-url https://releases.rancher.com/os/latest/rancheros.iso demo docker-machine ssh demo ps docker ps sudo system-docker ps sudo ros help sudo ros console list sudo ros console switch ubunu apt-get help
Dockerizing Applications/Detached mode
$ sudo docker run -d --name insane_babbage ubuntu:14.04 /bin/sh -c "while true; do echo hello world; sleep 1; done" $ sudo docker ps -l $ sudo docker logs insane_babbage $ sudo docker stop insane_babbage $ sudo docker ps
The -d flag tells Docker to run the container and put it in the background, to daemonize it.
According to https://docs.docker.com/engine/reference/run/#detached-vs-foreground, containers started in detached mode exit when the root process used to run the container exits, unless you also specify the --rm option. If you use -d with --rm, the container is removed when it exits or when the daemon exits, whichever happens first.
Auto restart after reboot
Add a --restart=always parameter. See the following
- https://docs.docker.com/engine/reference/commandline/run/#restart-policies-restart
- https://docs.docker.com/engine/admin/start-containers-automatically/#restart-policy-details
Working with Containers
$ sudo docker run -i -t ubuntu /bin/bash $ sudo docker version $ sudo docker $ sudo docker attach --help
Running a Web Application
$ sudo docker run -d -P training/webapp python app.py
Viewing our Web Application Container
$ sudo docker ps -l $ sudo docker run -d -p 5000:5000 training/webapp python app.py
Network Port Shortcut
$ sudo docker port nostalgic_morse 5000
Viewing the Web Application's Logs
$ sudo docker logs -f nostalgic_morse
Looking at our Web Application Container's processes
$ sudo docker top nostalgic_morse
Inspecting our Web Application Container
$ sudo docker inspect nostalgic_morse
Restart a Container
$ sudo docker start nostalgic_morse OR $ sudo docker restart nostalgic_morse
Removing our Web Application Container
$ sudo docker stop nostalgic_morse $ sudo docker rm nostalgic_morse
Note: Always remember that deleting a container is final!
Dockerize an SSH service
https://docs.docker.com/engine/examples/running_ssh_service/#environment-variables
Remove old docker containers
This post on stackoverflow.com.
$ sudo docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty sudo docker rm
Similarly to remove all exited containers
$ sudo docker ps -a | grep Exit | awk '{print $1}' | xargs sudo docker rm
To kill/stop (not delete) all running containers
$ sudo docker kill $(sudo docker ps -q)
To delete all stopped containers
$ sudo docker rm $(sudo docker ps -a -q) OR $ sudo docker rm `sudo docker ps -a -q`
It is also helpful to create bash aliases for these commands by editing ~/.bash_aliases file.
Work with container images
Note that it is better/necessary to put the Dockerfile in an empty directory to avoid the problem of taking a long time to build the image (sending build context to Docker daemon ...GB ) since it will grab files from the current directory.
sudo docker search sinatra sudo docker pull training/sinatra sudo docker run -t -i training/sinatra /bin/bash sudo docker commit -m="Added json gem" -a="Kate Smith" 0b2616b0e5a8 ouruser/sinatra:v2 sudo docker images mkdir sinatra cd sinatra touch Dockerfile sudo docker build -t="ouruser/sinatra:v2" . sudo docker push ouruser/sinatra sudo docker rmi training/sinatra
- The above exercise works on my home computer (64-bit Ubuntu 12.04). However when I want to remove an image, I need to do something extra.
$ sudo docker rmi training/sinatra Error response from daemon: Conflict, cannot delete f0f4ab557f95 because the container bc5175998df3 is using it, use -f to force FATA[0000] Error: failed to remove one or more images $ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $ $ sudo docker rm $(sudo docker ps -aq) bc5175998df3 b97cb467529c $ sudo docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ouruser/sinatra v2 bd6395724621 9 minutes ago 316.3 MB ubuntu 14.04 ed5a78b7b42b 4 days ago 188.3 MB ubuntu latest ed5a78b7b42b 4 days ago 188.3 MB training/sinatra latest f0f4ab557f95 6 months ago 447 MB $ sudo docker rmi training/sinatra Untagged: training/sinatra:latest Deleted: f0f4ab557f954f3e04177663a3af90e88641bcdcce1f02ac900dbd9768ef4945 ... Deleted: 3e76c0a80540a0d36493ae7110796fc92f559a191454e3ac19c1d4c650bdd9e0 $ sudo docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ouruser/sinatra v2 bd6395724621 10 minutes ago 316.3 MB ubuntu latest ed5a78b7b42b 4 days ago 188.3 MB ubuntu 14.04 ed5a78b7b42b 4 days ago 188.3 MB $ sudo docker rmi ouruser/sinatra Error response from daemon: No such image: ouruser/sinatra:latest FATA[0000] Error: failed to remove one or more images $ sudo docker rmi ouruser/sinatra:v2 Untagged: ouruser/sinatra:v2 Deleted: bd6395724621a89384ec58c116ce113ae8371f31f20f0adc540bbc76c6049d12 ... Deleted: 41ce107b0a0bb6a70834477e3b550386fc453de363d8a20f0579df055e9ece50
- I get an error when I try to launch sinatra on my 32-bit ubuntu (Docker can only be installed through apt-get on 32-bit)
$ sudo docker run -t -i training/sinatra /bin/bash 2014/12/31 02:43:26 exec format error
- I get lots of errors when I run docker build command on my 64-bit Ubuntu.
$ sudo docker build -t="ouruser/sinatra:v2" . Sending build context to Docker daemon 2.56 kB Sending build context to Docker daemon Step 0 : FROM ubuntu:14.04 Pulling repository ubuntu ed5a78b7b42b: Download complete 511136ea3c5a: Download complete fe95bf7d5f50: Download complete 9a4594fe74ea: Download complete 8c4b1edcceea: Download complete ---> ed5a78b7b42b Step 1 : MAINTAINER Kate Smith <[email protected]> ---> Running in 63614919cafd ---> 5bac5869eb36 Removing intermediate container 63614919cafd Step 2 : RUN apt-get update && apt-get install -y ruby ruby-dev ---> Running in 68e8ccfa5f7c Err http://archive.ubuntu.com trusty InRelease Err http://archive.ubuntu.com trusty-updates InRelease Err http://archive.ubuntu.com trusty-security InRelease Err http://archive.ubuntu.com trusty Release.gpg Could not resolve 'archive.ubuntu.com' Err http://archive.ubuntu.com trusty-updates Release.gpg Could not resolve 'archive.ubuntu.com' Err http://archive.ubuntu.com trusty-security Release.gpg Could not resolve 'archive.ubuntu.com' Reading package lists... W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/InRelease W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg Could not resolve 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg Could not resolve 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg Could not resolve 'archive.ubuntu.com' W: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Building dependency tree... Reading state information... Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: ruby-dev : Depends: ruby1.9.1-dev (>= 1.9.3.194-1) but it is not going to be installed E: Unable to correct problems, you have held broken packages. 2014/12/30 16:03:21 The command [/bin/sh -c apt-get update && apt-get install -y ruby ruby-dev] returned a non-zero code: 100
Resources allocated to a container using docker?
hub.docker.com
- Note that Dockerfile is optional on https://registry.hub.docker.com.
- rocker. The dockerfile is included there.
- Search all repositories related to R
- baseimage-docker. I can use ping command without special argument when I start phusion/baseimage.
sudo docker pull phusion/baseimage sudo docker run -ti phusion/baseimage /bin/bash
- https://dockerfile.github.io/ which includes dockerfiles for different purposes. The ubuntu-desktop one also works well (client needs a vnc viewer in order to see the desktop).
Set up a private Docker registry
- https://docs.docker.com/registry/deploying/
- Ubuntu 14.04 from digitalocean
- How to Setup Secure Docker Registry on Linux using TLS SSL Certificate
Dockerfile
- Dockerfile Reference
- Using Dockerfiles to Automate Building of Images from digitalocean.com.
Remember to put the Dockerfile in an empty directory.
Examples of Dockerfile
How to use Dockerfile
sudo docker build -t [myname] .
Dockerfile in One Line
FROM ubuntu
Using This simple Dockerfile and the docker command sudo docker build -t scooby_snacks . will result in
$ sudo docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ubuntu 15.04 2427658c75a1 42 hours ago 117.5 MB ubuntu vivid 2427658c75a1 42 hours ago 117.5 MB ubuntu vivid-20150218 2427658c75a1 42 hours ago 117.5 MB ubuntu utopic-20150211 78949b1e1cfd 42 hours ago 194.4 MB ubuntu utopic 78949b1e1cfd 42 hours ago 194.4 MB ubuntu 14.10 78949b1e1cfd 42 hours ago 194.4 MB ubuntu 14.04 2d24f826cb16 42 hours ago 188.3 MB ubuntu 14.04.2 2d24f826cb16 42 hours ago 188.3 MB ubuntu trusty 2d24f826cb16 42 hours ago 188.3 MB ubuntu trusty-20150218.1 2d24f826cb16 42 hours ago 188.3 MB ubuntu latest 2d24f826cb16 42 hours ago 188.3 MB scooby_snacks latest 2d24f826cb16 42 hours ago 188.3 MB ubuntu precise 1f80e9ca2ac3 42 hours ago 131.5 MB ubuntu precise-20150212 1f80e9ca2ac3 42 hours ago 131.5 MB ubuntu 12.04.5 1f80e9ca2ac3 42 hours ago 131.5 MB ubuntu 12.04 1f80e9ca2ac3 42 hours ago 131.5 MB ubuntu 14.04.1 5ba9dab47459 3 weeks ago 188.3 MB ubuntu 12.10 c5881f11ded9 8 months ago 172.2 MB ubuntu quantal c5881f11ded9 8 months ago 172.2 MB ubuntu 13.04 463ff6be4238 8 months ago 169.4 MB ubuntu raring 463ff6be4238 8 months ago 169.4 MB ubuntu 13.10 195eb90b5349 8 months ago 184.7 MB ubuntu saucy 195eb90b5349 8 months ago 184.7 MB ubuntu 10.04 3db9c44f4520 10 months ago 183 MB ubuntu lucid 3db9c44f4520 10 months ago 183 MB
Link containers together
https://docs.docker.com/userguide/dockerlinks/
Manage data in containers
https://docs.docker.com/userguide/dockervolumes/
Working with Docker hub
https://docs.docker.com/userguide/dockerrepos/
GUI apps
- https://pelle.io/2014/07/11/delivering-gui-applications-with-docker/ Forward X11 approach
- https://linuxmeerkat.wordpress.com/2014/10/17/running-a-gui-application-in-a-docker-container/ Forward X11
- http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/ Share X11 socket
- https://github.com/rogaha/docker-desktop Xpra + Xephyr
- https://github.com/fcwu/docker-ubuntu-vnc-desktop VNC approach
Misc
LXC (raw Linux containers) vs Docker
https://diveintodocker.com/blog/why-i-got-started-with-docker
Vagrant vs Docker
Access the internet from the container
Run the container with the '--net=host' option
sudo docker run --net=host -it ubuntu /bin/bash
Location of Docker images (/etc/default/docker.io)
- http://blog.thoward37.me/articles/where-are-docker-images-stored/
- http://stackoverflow.com/questions/19234831/where-are-docker-images-stored-on-the-host-machine
- https://docs.docker.com/reference/commandline/cli/
- http://stackoverflow.com/questions/21016210/function-of-docker-directory-structure-in-var-lib-docker
The default is /var/lib/docker. But we can change the default location to another place. For example,
sudo nano /etc/default/docker.io # Add a line DOCKER_OPTS="-g /home/brb/Docker"
Then after running sudo service docker.io restart and then a simple pull sudo docker pull rocker/r-base or sudo docker run --rm -ti rocker/r-base (the Dockerfile of r-base is available on github.com, --rm option means Automatically remove the container when it exits), we will see something like this:
$ sudo docker run --rm -ti rocker/r-base Unable to find image 'rocker/r-base:latest' locally Pulling repository rocker/r-base ca3e0842c8f7: Download complete b2601258a687: Download complete c47fad72b020: Download complete 625e14fa4ae0: Download complete 13711ce90d62: Download complete 116733e9a647: Download complete 616527c7a2af: Download complete ffcc1c0a1e17: Download complete 6400c17017f4: Download complete 68855631fa1e: Download complete 6c218b542d06: Download complete 973a399c73a9: Download complete Status: Downloaded newer image for rocker/r-base:latest $ sudo docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE rocker/r-base latest 0f9a4a6133e9 5 days ago 499.7 MB $ sudo docker -v Docker version 1.0.1, build 990021a $ sudo docker -D info Containers: 0 Images: 13 Storage Driver: aufs Root Dir: /home/brb/Docker/aufs Dirs: 13 Execution Driver: native-0.2 Kernel Version: 3.13.0-32-generic Debug mode (server): false Debug mode (client): true Fds: 9 Goroutines: 10 EventsListeners: 0 Init SHA1: 6578c4a98eb5aaa1db564782fd990839ebca1b4d Init Path: /usr/lib/docker.io/dockerinit WARNING: No swap limit support $ sudo cat Docker/repositories-aufs | python -mjson.tool bash: su/repositories-aufs: No such file or directory No JSON object could be decoded brb@vm-1404:~$ sudo cat Docker/repositories-aufs | python -mjson.tool { "Repositories": { "rocker/r-base": { "latest": "0f9a4a6133e94d2e2ae092d447cfcc5366145ab62799de1c706ac9af90ce002a" } } } $ sudo ls -lh Docker/graph/0f9a4a6133e94d2e2ae092d447cfcc5366145ab62799de1c706ac9af90ce002a total 8.0K -rw------- 1 root root 1.6K Feb 22 16:21 json -rw------- 1 root root 1 Feb 22 16:21 layersize $ sudo cat Docker/graph/0f9a4a6133e94d2e2ae092d447cfcc5366145ab62799de1c706ac9af90ce002a/json | python -mjson.tool { "Size": 0, "architecture": "amd64", "author": "\"Carl Boettiger and Dirk Eddelbuettel\" [email protected]", "config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "R" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": null, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "LC_ALL=en_US.UTF-8", "R_BASE_VERSION=3.1.2" ], "ExposedPorts": null, "Hostname": "03797203757d", "Image": "77b9aab5d3f0b345c921a19bf29f3bc10ecc3712d9b55f98d35404b001f8574a", "MacAddress": "", "Memory": 0, "MemorySwap": 0, "NetworkDisabled": false, "OnBuild": [], "OpenStdin": false, "PortSpecs": null, "StdinOnce": false, "Tty": false, "User": "", "Volumes": null, "WorkingDir": "" }, "container": "ad8b63a987e194bf19b6eecdb2bfb39576c1952601e8165937ee97f2925b017e", "container_config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "/bin/sh", "-c", "#(nop) CMD [R]" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": null, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "LC_ALL=en_US.UTF-8", "R_BASE_VERSION=3.1.2" ], "ExposedPorts": null, "Hostname": "03797203757d", "Image": "77b9aab5d3f0b345c921a19bf29f3bc10ecc3712d9b55f98d35404b001f8574a", "MacAddress": "", "Memory": 0, "MemorySwap": 0, "NetworkDisabled": false, "OnBuild": [], "OpenStdin": false, "PortSpecs": null, "StdinOnce": false, "Tty": false, "User": "", "Volumes": null, "WorkingDir": "" }, "created": "2015-02-17T05:51:23.32446339Z", "docker_version": "1.5.0", "id": "0f9a4a6133e94d2e2ae092d447cfcc5366145ab62799de1c706ac9af90ce002a", "os": "linux", "parent": "77b9aab5d3f0b345c921a19bf29f3bc10ecc3712d9b55f98d35404b001f8574a" } $ sudo tree -L 2 Docker Docker ├── aufs │ ├── diff │ ├── layers │ └── mnt ├── containers ├── execdriver │ └── native ├── graph │ ├── 0e30e84e9513cb3d9d991389adfb77ac6afc9d75a5234e3d61af2f080c75d0ce │ ├── 0f9a4a6133e94d2e2ae092d447cfcc5366145ab62799de1c706ac9af90ce002a │ ├── 1f17c3b77bd72500adf49e5cfb9fcc78b004b9714ea7497031f8258bd95a51a0 │ ├── 326e7f15a5c9831976703bd25c84a02548c2dbec3514447f6d29b58e0fc4c6cf │ ├── 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158 │ ├── 53e67b52fa37780ab20d519569cc734919d4b226e086b369b0472649d68825bd │ ├── 5e8cefe0213ea6630ddfed346b255467ca35c22abc4b876bd4a2865dbe3a0a3f │ ├── 77b9aab5d3f0b345c921a19bf29f3bc10ecc3712d9b55f98d35404b001f8574a │ ├── 8771fbfe935cde12b40418e029cdb68adff76d740eddb72fc6c811b1b4c16a3e │ ├── b00c2273d1a6ed96c88465612ea5e5ea1f1f10305151d2f9ddd94ec279d9e94f │ ├── b608f23507fe1fbcb36641ff7ea21efa046fef3977ced56449c32e53d9bbe65d │ ├── be55497bbb9c1aaa4fc18af5928217430f81fad8ca5a2dd420326f844f55b8d7 │ ├── e1a31145a2addc108cd77af268d3f4312b954081ddd7e3522026047a8f29b11f │ └── _tmp ├── init │ └── dockerinit-1.0.1 ├── linkgraph.db ├── repositories-aufs └── volumes $ sudo ls -lh Docker/aufs/diff/8771fbfe935cde12b40418e029cdb68adff76d740eddb72fc6c811b1b4c16a3e/ total 76K drwxr-xr-x 2 root root 4.0K Jan 27 11:55 bin drwxr-xr-x 2 root root 4.0K Nov 30 07:37 boot drwxr-xr-x 2 root root 4.0K Jan 27 11:56 dev drwxr-xr-x 41 root root 4.0K Jan 27 11:55 etc drwxr-xr-x 2 root root 4.0K Nov 30 07:37 home drwxr-xr-x 9 root root 4.0K Nov 27 14:59 lib drwxr-xr-x 2 root root 4.0K Jan 27 11:51 lib64 drwxr-xr-x 2 root root 4.0K Jan 27 11:49 media drwxr-xr-x 2 root root 4.0K Jan 27 11:49 mnt drwxr-xr-x 2 root root 4.0K Jan 27 11:49 opt drwxr-xr-x 2 root root 4.0K Jan 27 11:56 proc drwx------ 2 root root 4.0K Jan 27 11:49 root drwxr-xr-x 3 root root 4.0K Jan 27 11:49 run drwxr-xr-x 2 root root 4.0K Jan 27 11:55 sbin drwxr-xr-x 2 root root 4.0K Jan 27 11:49 srv drwxr-xr-x 2 root root 4.0K Nov 11 14:37 sys drwxrwxrwt 2 root root 4.0K Jan 27 11:56 tmp drwxr-xr-x 10 root root 4.0K Jan 27 11:49 usr drwxr-xr-x 11 root root 4.0K Jan 27 11:49 var $ sudo ls -lh Docker/graph/8771fbfe935cde12b40418e029cdb68adff76d740eddb72fc6c811b1b4c16a3e/ total 8.0K -rw------- 1 root root 1.6K Feb 22 16:19 json -rw------- 1 root root 9 Feb 22 16:19 layersize
Applications
Some popular Linux applications such as: owncloud, lamp, openstack, node.js, roundcube, DLNA/Server, madsonic, webproxy/webfilter, DHCP/DNS-Server like dnsmasq, cloudprint, ...
Illumina BaseSpace
- http://blog.basespace.illumina.com/2013/10/21/introducing-the-native-app-engine/
- https://developer.basespace.illumina.com/docs/content/documentation/getting-started/overview
- https://developer.basespace.illumina.com/docs/content/documentation/native-apps/manage-docker-image
Bioinformatics analyses
Hot-starting software containers for bioinformatics analyses
Cloud provider
Docker can be deployed on any cloud provider like Digital Ocean, Amazon Web Services (AWS), Microsoft Azure, Google Cloud Computing.
- https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-docker-application
- http://go.mkb.io/post/118463195802/docker-machine-with-digital-ocean
- http://networkstatic.net/running-docker-machine-on-digital-ocean/
- http://linoxide.com/linux-how-to/use-docker-machine-cloud-provider/
- HTC採用AWS的三大原因: 上市時間縮短、節省成本以及提供創新發想的低成本空間。
Use with R
- http://dirk.eddelbuettel.com/papers/useR2014_keynote.pdf and http://dirk.eddelbuettel.com/papers/r_and_docker_sep2014.pdf
- http://dirk.eddelbuettel.com/blog/2014/10/23/
- Running RStudio and the instruction using rocker.
- Rocker (To start an interactive R session, use sudo docker run --rm -ti rocker/r-base)
- r-base from github repository of the Official Docker Images.
- Extensions from r-base. For example, r-spatial-base. It also mentions ropensci container is built upon rocker/rstudio.
Dockerfile
Create a new directory and a new file 'Dockerfile' with the content.
FROM debian:testing MAINTAINER Dirk Eddelbuettel [email protected] ## Remain current RUN apt-get update -qq RUN apt-get dist-upgrade -y RUN apt-get install -y --no-install-recommends r-base r-base-dev r-recommended littler RUN ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r
NOTE
- I ran into errors when I use the above (short) Dockerfile. But the Dockerfile from rocker (leave out the last line of launching R) works well. The R packages built in the image include 'docopt', 'magrittr', 'stringi', and 'stringr'.
- Install R package is possible when we launch a container. But we are not able to save the packages?? The rocker wiki also mentions something about installing packages.
- See also How to save data in wiki.
docker run
Note that if we are using the Dockerfile above to create an image, we will be dropped to the Linux shell. If we are pulling the rocker/r-base image from Docker Hub, we will be in R console directly. See the last line of Dockerfile on github website for rocker.
Then run the following to do some exercise (We could possibly replace 21b6a9e8b9e8 with your image ID or use rocker/r-base). For simplicity, we can try the colortools package first which does not depend on other packages and there is no need to compile the package.
sudo docker build -t debian:testing-add-r . # create an image based on the above Dockerfile wget http://cran.r-project.org/src/contrib/sanitizers_0.1.0.tar.gz sudo docker run -v `pwd`:/mytmp -t 21b6a9e8b9e8 \ R CMD check --no-manual --no-build-vignettes /mytmp/sanitizers_0.1.0.tar.gz sudo docker run -v `pwd`:/mytmp -t 21b6a9e8b9e8 \ Rdevel CMD check --no-manual --no-build-vignettes /mytmp/sanitizers_0.1.0.tar.gz sudo docker search eddelbuettel sudo docker pull eddelbuettel/docker-ubuntu-r # default tag is 'latest'; actually older than the other tags sudo docker images eddelbuettel/docker-ubuntu-r # see the tag column sudo docker pull eddelbuettel/docker-ubuntu-r:add-r # the tag name can only be obtained from hub.docker.com sudo docker images eddelbuettel/docker-ubuntu-r # see the tag column sudo docker pull eddelbuettel/docker-ubuntu-r:add-r-devel sudo docker images eddelbuettel/docker-ubuntu-r # see the tag column sudo docker run -v `pwd`:/mytmp -t 54d865dbd2c9 R CMD check --no-manual --no-build-vignettes /mytmp/sanitizers_0.1.0.tar.gz sudo docker run -t -i eddelbuettel/docker-ubuntu-r /bin/bash $ sudo docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE debian testing-add-r 21b6a9e8b9e8 28 minutes ago 572.2 MB ubuntu 14.04 ed5a78b7b42b 4 days ago 188.3 MB ubuntu latest ed5a78b7b42b 4 days ago 188.3 MB debian testing 88ba2870bfbe 7 weeks ago 154.7 MB eddelbuettel/docker-ubuntu-r add-r-devel c998a74a1fb4 11 weeks ago 460.4 MB eddelbuettel/docker-ubuntu-r add-r 54d865dbd2c9 11 weeks ago 460.4 MB eddelbuettel/docker-ubuntu-r latest a7cd5ddeb98e 5 months ago 515.4 MB sudo docker logs xxxxx # view the log sudo docker restart xxxxx sudo docker exec -it xxxx /bin/bash # view any changes in R library sudo docker stop xxxxx sudo docker docker rm xxxxx
This is another example of using 'docker run' accompanying MotifBreakR package.
Testing R packages
- RColorBrewer (pure R)
- digtest (need compile)
- randomForest (need compile & has suggests RColorBrewer)
Docker for R Package Development
http://www.jimhester.com/2017/10/13/docker/
A DevOps Perspective
More examples
Docker for Shiny Server
- https://hub.docker.com/r/rocker/shiny/. Pay attention to the Dockerfile there.
- Shiny Administrator Guide
- Docker Reference. See Engine (docker) CLI from their LHS.
- Dockering a shiny app
- Question: what happened if there is a new version of R or shiny-sever?
# specify --name so we don't need to use container id to access it later $ docker run -d --name rshiny -p 81:3838 rocker/shiny $ docker ps -l # Run in container's bash # https://stackoverflow.com/questions/30172605/how-to-get-into-a-docker-container # non-interactive $ docker exec -it rshiny ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 22: eth0@if23: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 172.17.0.2/16 scope global eth0 valid_lft forever preferred_lft forever # interactive shell $ docker exec -it rshiny bash root@5b78988d5619:/# who root@5b78988d5619:/# which R /usr/bin/R root@5b78988d5619:/# ls /home docker shiny root@5b78988d5619:/# ls /srv/shiny-server 01_hello 02_text 03_reactivity 04_mpg 05_sliders 06_tabsets 07_widgets 08_html 09_upload 10_download 11_timer index.html sample-apps root@5b78988d5619:/# R -e 'package.Description("glmnet")' root@5b78988d5619:/# exit $ docker stop rshiny $ docker rm rshiny # remove the container
It is also useful to use the -v option in docker run so the local directory (eg /srv/shinyapps/) can be mapped to the docker volume (/srv/shiny-server).
# Put your shiny app in host's /srv/shinyapps/appdir, $ docker run -d -p 81:3838 \ -v /srv/shinyapps/:/srv/shiny-server/ \ -v /srv/shinylog/:/var/log/shiny-server/ \ rocker/shiny
And check running status
$ docker ps -a
Check opened ports
See What network ports are open: lsof or netstat.
$ netstat -ant Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN ... tcp6 0 0 :::80 :::* LISTEN tcp6 0 0 :::81 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 ::1:25 :::* LISTEN
Docker containers for Bioconductor
The Dockerfiler for different images can be found on github.com/Bioconductor/bioc_docker.
Today is 2/5/2015.
$ sudo docker pull bioconductor/release_base $ sudo docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE bioconductor/release_base latest 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150130 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150129 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150201 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150202 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150203 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150204 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150205 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150128 7eefbf783d9b 8 days ago 2.602 GB bioconductor/release_base 20150131 7eefbf783d9b 8 days ago 2.602 GB
Note that even we specify the tag 'latest' we still get the same list of images as above
$ sudo docker pull bioconductor/release_base:latest
BiocImageBuilder
Reproducible Bioconductor workflows using browser-based interactive notebooks and containers
Nginx
- How To Run Nginx in a Docker Container on Ubuntu 14.04
- How To Containerize and Use Nginx as a Proxy
- TIPS FOR DEPLOYING NGINX (OFFICIAL IMAGE) WITH DOCKER
- Docker 快速入门
MySQL
Deploying MySQL on Linux with Docker
Mediawiki
- https://www.mediawiki.org/wiki/Docker
- https://hub.docker.com/_/mediawiki/
- Running Mediawiki as Docker container (WORKS tested on GalliumOS)
- Follow Run MySql inside docker container first. 1. Setup host to store configuration, data and dumps. The 'dumps' and 'initdb.d' folders are optional 2. Override default mysql configuration 3. Executing scripts and sql on container startup (optional) 4. Starting mysql container
- Visit http://IP_address:8080 to see the mediawiki page running on Docker
brb@galliumos:~$ tree mysql mysql ├── conf.d │ └── mysql.cnf ├── data │ ├── auto.cnf │ ├── ca-key.pem │ ├── ca.pem │ ├── client-cert.pem │ ├── client-key.pem │ ├── ib_buffer_pool │ ├── ibdata1 │ ├── ib_logfile0 │ ├── ib_logfile1 │ ├── ibtmp1 │ ├── mediawiki [error opening dir] │ ├── mysql [error opening dir] │ ├── performance_schema [error opening dir] │ ├── private_key.pem │ ├── public_key.pem │ ├── server-cert.pem │ ├── server-key.pem │ ├── sys [error opening dir] │ └── wikidb [error opening dir] ├── dumps └── initdb.d 9 directories, 15 files brb@galliumos:~$ tree -L 2 mediawiki/ mediawiki/ ├── config │ └── LocalSettings.php ├── extensions │ ├── Cite │ ├── ConfirmEdit │ ├── Gadgets │ ├── ImageMap │ ├── InputBox │ ├── Interwiki │ ├── LocalisationUpdate │ ├── Nuke │ ├── ParserFunctions │ ├── PdfHandler │ ├── Poem │ ├── README │ ├── Renameuser │ ├── SpamBlacklist │ ├── SyntaxHighlight_GeSHi │ ├── TitleBlacklist │ └── WikiEditor └── images └── README 19 directories, 3 files
- Isolated MediaWiki Setup on the Raspberry Pi using Docker, Part 1
- https://jzweig.com/blog/setup-mediawiki-and-postgres-with-docker/
- https://linuxconfig.org/mediawiki-easy-deployment-with-docker-container
Plex
Official Docker container for Plex Media Server
DNS server
ONLYOFFICE
- https://www.howtoforge.com/tutorial/how-to-install-onlyoffice-8.9.0-with-docker-on-ubuntu/
- https://www.howtoforge.com/tutorial/how-to-update-onlyoffice-to-version-95-with-docker/ This involves backing up and restoring MYSQL data.
NAS & Docker
http://www.ithome.com.tw/tech/96500
Some examples
- GetLab專案管理工具
- Jenkins開發版本管理工具
Run a benchmark program on ARM devices
- Beaglebone black as an example. More device examples can be found on http://www.testing-software.org/.
Set up a Mastodon Instance on Linux
Your Own Social Network: How to Set Up a Mastodon Instance on Linux
Other containers
Singularity
Singularity enables users to have full control of their environment; Singularity containers let users run applications in a Linux environment of their choosing.
Singularity at NIH/Biowulf.
Shifter
Orchestrator
Kubernete
- https://www.docker.com/kubernetes
- Create a 2-node Kubernetes cluster in 10 minutes
- Deploying Java Applications with Docker and Kubernetes
CoreOS
Installation
- Quick Start
- Installing CoreOS on a bare metal or virtual machine from the user Format C: in youtube
- Assigning Static IP to a CoreOS Server
- Mounting storage in CoreOS
- Installing, Deploying Docker containers with Fig / Docker Compose on boot2docker or CoreOS
- Running a Private Docker Registry Container
We first boot a liveCD from any OS (CentOS works but Ubuntu 16.04 gave errors). In Virtualbox, we choose 'Red Hat' if we use CentOS.
Once the VM is created. We go to the settings. Create a bridged network or host-only network first (even we can get files from the host without creating a host-only network). Storage: choose CentOS-7.
- Get the install script from Github and create <coreos_install.sh> and chmod +x
- create <cloud-config.yaml> file which will include ssh_authorized_keys generated from another machine. It should also contain a new token for the cluster from https://discovery.etcd.io/new.
- ls -l /dev/sd*
- run sudo ./coreos_install.sh -d /dev/sda -C stable -c cloud-config.yaml. It will download the latest stable CoreOS, install to the HD
- Don't leave the VM or it will freeze. Issue sudo shutdown -h now once we see the word 'Success' at the last line of the output.
- Remove CentOS from the VM storage. Boot the coreOS VM.
The new screen shows corebm1 login with an IP. Go back to another machine and type ssh -i /tmp/CoreOSBM_rsa [email protected]. Inside CoreOS, we can type docker images.
The 'cloud-config.yaml file has to follow the format in https://coreos.com/os/docs/latest/cloud-config.html. Use the online validator https://coreos.com/validate/ to correct. At first I use the file from the youtube video. There is no error coming out when I ran the installation script. But I cannot connect to coreOS. The cloud-config.yaml file I use is (pay attention to '-', double quotes and indent characters)
#cloud-config # # set hostname hostname: CoreBM1 # Set ssh key ssh_authorized_keys: - "ssh-rsa AAAAB3 ..... brb@T3600" coreos: etcd: discovery: "https://discovery.etcd.io/d3e95 .... " # sudo ./installos -d /dev/sda -C stable -c cloud-config.yaml
CoreOS exploration
brb@T3600 /tmp $ ssh -i /tmp/id_rsa [email protected] Enter passphrase for key '/tmp/id_rsa': CoreOS stable (1010.6.0) core@CoreBM1 ~ $ core@CoreBM1 ~ $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE core@CoreBM1 ~ $ df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.4G 0 1.4G 0% /dev tmpfs 1.4G 0 1.4G 0% /dev/shm tmpfs 1.4G 340K 1.4G 1% /run tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup /dev/sda9 18G 23M 17G 1% / /dev/sda3 985M 589M 345M 64% /usr tmpfs 1.4G 0 1.4G 0% /media /dev/sda1 128M 37M 92M 29% /boot tmpfs 1.4G 0 1.4G 0% /tmp /dev/sda6 108M 52K 99M 1% /usr/share/oem core@CoreBM1 ~ $ free -m total used free shared buffers cached Mem: 2713 187 2525 0 9 109 -/+ buffers/cache: 68 2644 Swap: 0 0 0 core@CoreBM1 ~ $ lsb_release -a -bash: lsb_release: command not found core@CoreBM1 ~ $ docker pull ubuntu Using default tag: latest latest: Pulling from library/ubuntu f069f1d21059: Pull complete ecbeec5633cf: Pull complete ea6f18256d63: Pull complete 54bde7b02897: Pull complete Digest: sha256:bbfd93a02a8487edb60f20316ebc966ddc7aa123c2e609185450b96971020097 Status: Downloaded newer image for ubuntu:latest core@CoreBM1 ~ $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu latest 0f192147631d 7 days ago 132.7 MB core@CoreBM1 ~ $
CoreOS cluster discovery
https://coreos.com/os/docs/latest/cluster-discovery.html
etcd
fleet
Resource
Books
- The Docker Book: Containerization is the new virtualization
- Orchestrating Docker
- Docker Hands on: Deploy, Administer Docker Platform