Difference between revisions of "Docker"

From BITPlan profiwiki Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
|wikipediaurl=https://en.wikipedia.org/wiki/Docker_%28software%29
 
|wikipediaurl=https://en.wikipedia.org/wiki/Docker_%28software%29
 
|stackoverflow=http://stackoverflow.com/questions/tagged/docker
 
|stackoverflow=http://stackoverflow.com/questions/tagged/docker
|stackoverflowQuestionCount=6731
+
|stackoverflowQuestionCount=49,616
 
|category=Build
 
|category=Build
 
|storemode=property
 
|storemode=property
Line 147: Line 147:
 
The process can be automated using a {{Link|target=Dockerfile}}
 
The process can be automated using a {{Link|target=Dockerfile}}
 
== Critics ==
 
== Critics ==
http://www.boycottdocker.org/
+
* http://www.boycottdocker.org/
 +
* https://thehftguy.com/2016/11/01/docker-in-production-an-history-of-failure/
 +
* https://github.com/moby/moby/issues/23203
 +
* https://www.reddit.com/r/docker/comments/8n7app/the_joy_of_containers_virtualisation_and/
  
 
== Docker book ==
 
== Docker book ==
 
<pdf>http://dockerbook.com/TheDockerBook_sample.pdf</pdf>
 
<pdf>http://dockerbook.com/TheDockerBook_sample.pdf</pdf>
 
[[Category:Examples]]
 
[[Category:Examples]]

Latest revision as of 15:40, 5 January 2019

Tool
name  Docker
logo  DockerLogo.png
logourl  logo.png
website  https://www.docker.com/
wikipediaurl  https://en.wikipedia.org/wiki/Docker_%28software%29
stackoverflow link  http://stackoverflow.com/questions/tagged/docker
no of stackoverflow questions  49,616
Category  Build
pollResult  


Virtual Machine versus Container

MJHfm1c.jpg

Introduction to Docker by Solomon Hykes

  • Shipping code to the server is too hard
  • Docker uses separation of concerns (just like the Y-principle) to make shipping easier
  • Docker images are manipulated git style with ids, diffs, commits, pushs and pulls

Links

Installation

Installation of Docker on Mac OS X

  1. Download Docker Toolbox
  2. Install (e.g. DockerToolbox-1.8.3.pkg)
  3. Either Use Kitematic Visual Management for Docker or Docker Quickstart Terminal Command Line Interface

Clipboard20151017102651.png

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/


docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com

Installation of Docker on Linux

Docker command examples

upgrade docker machine

docker-machine upgrade default

list running docker processes

bash-3.2$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

get and start the latest ubuntu image

docker run ubuntu

see which images are available

bash-3.2$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              latest              0a17decee413        4 days ago          188.4 MB
bash-3.2$ 

start a bash shall in ubuntu

docker run -i -t ubuntu /bin/bash

modify the image by creating new directory

root@84506e084bb9:/#touch /test

look at processes again and check the difference of the image with the given container id

bash-3.2$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
84506e084bb9        ubuntu              "/bin/bash"         2 minutes ago       Up 2 minutes                            pensive_wozniak
bash-3.2$ docker diff 84506e084bb9
A /test

install some software

root@84506e084bb9:/#apt-get install php5
root@84506e084bb9:/#apt-get install mysql-server

commit the changes to images with the name "lamp" and check the image list again

bash-3.2$ docker commit 84506e084bb9 lamp
8ba719cd9b0eae589b70f6b6ddd567b4c20f997fc2d8f4c6feb313d73c2d5c3a

bash-3.2$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
lamp                latest              8ba719cd9b0e        20 seconds ago      349.5 MB
ubuntu              latest              0a17decee413        4 days ago          188.4 MB
bash-3.2$
docker version
Client:
 Version:      1.8.3
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   f4bf5c7
 Built:        Mon Oct 12 18:01:15 UTC 2015
 OS/Arch:      darwin/amd64

Server:
 Version:      1.8.3
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   f4bf5c7
 Built:        Mon Oct 12 18:01:15 UTC 2015
 OS/Arch:      linux/amd64

Useful scripts

Docker goodies

Static content example

Use the nginx image from https://github.com/docker-library/docs/tree/master/nginx

docker run --name icon_html -v /Users/wf/Documents/workspace/com.bitplan.icons/src/main/resources/com/bitplan/icons:/usr/share/nginx/html:ro -d -p 8080:80 nginx

find out the ip address for the mapping (Mac OS X)

docker-machine env default
export DOCKER_HOST="tcp://192.168.99.100:2376"

try out via

http://192.168.99.100:8080/48x48/shadow/wrench.png

wrench.png

Dockerfile

The process can be automated using a Dockerfile

Critics

Docker book

load PDF