My name is Vasyl Khrystiuk‎ > ‎process‎ > ‎main‎ > ‎

docker

docker run ubuntu /bin/echo 'Hello world'
docker run -t -i ubuntu /bin/bash
-i -- interactive
-t -- assigt tty to terminal
$ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
0890757debe93f2273b93dc1dd94f04d2ea30703fbc9e770c3bd7c76a73d7535
-d -- deamon

$ docker ps
CONTAINER ID        IMAGE               COMMAND                    CREATED                 STATUS              PORTS           NAMES
0890757debe9        ubuntu              "/bin/sh -c 'while tr"   24 seconds ago     Up 24 seconds                           sick_jang

$ docker logs 0890757debe9

$ docker stop 0890757debe9
0890757debe9

$ docker version
Client:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 21:49:11 2016
 OS/Arch:      windows/amd64

Server:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 21:49:11 2016
 OS/Arch:      linux/amd64

$ docker run -d -P training/webapp python app.py
23fdd9b7f5e52e4e0867cc991fe4723cf49fc5529a16d1336dc9ff97b55fba76
-P -- map ports

$ docker ps 
CONTAINER ID  IMAGE                   COMMAND          CREATED            STATUS            PORTS                        
23fdd9b7f5e5   training/webapp  "python app.py"  35 seconds ago  Up 35 seconds 0.0.0.0:32768->5000/tcp 

 NAMES
 nostalgic_blackwell


$ docker-machine ip
192.168.99.100

$ docker logs 23fdd9b7f5e5
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
192.168.99.1 - - [18/Apr/2016 17:30:24] "GET / HTTP/1.1" 200 -
192.168.99.1 - - [18/Apr/2016 17:30:25] "GET /favicon.ico HTTP/1.1" 404 -

$ docker top nostalgic_blackwell
PID                 USER                COMMAND
3642                root                python app.py


$ docker inspect nostalgic_blackwell
{}

$ docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                       PORTS               NAMES
23fdd9b7f5e5        training/webapp     "python app.py"     11 minutes ago      Exited (137) 3 seconds ago                       nostalgic_blackwell


$ docker search jetty
NAME                                   DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
jetty                                  Jetty provides a Web server and javax.serv...   99        [OK]
consol/jetty-9                         Jetty 9.2.6, 8080                               3                    [OK]


$ docker run -d -p 8080:8080 jetty
cea6772ac33f764affaf1804434e986516ace133ffe07f6d28aec3541132b47a

$ pwd
/c/Users/Vasya

$ mkdir sinatra
$ cd sinatra
$ touch Dockerfile

# This is a comment
FROM ubuntu:15.10
MAINTAINER Kate Smith <ksmith@example.com>
RUN apt-get update && apt-get install -y ruby ruby-dev
RUN gem install sinatra

$ cd ..
$ pwd
/c/Users/Vasya

$ docker build sinatra
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM ubuntu:15.10
15.10: Pulling from library/ubuntu
Digest: sha256:17f945471be169657c2e95e368e585bcdf70b8732764b1bb24216f128b433078
Status: Downloaded newer image for ubuntu:15.10
 ---> 4e3b13c8a266
Step 2 : MAINTAINER Kate Smith <ksmith@example.com>
 ---> Running in f866e4abd583
 ---> 49b324f63aa2
Removing intermediate container f866e4abd583
Step 3 : RUN apt-get update && apt-get install -y ruby ruby-dev
 ---> Running in 7a340950599b
Hit http://archive.ubuntu.com wily InRelease
Fetched 21.9 MB in 45s (485 kB/s)
Running hooks in /etc/ca-certificates/update.d...
done.
 ---> 11a4817968b3
Removing intermediate container 7a340950599b
Step 4 : RUN gem install sinatra
 ---> Running in 360ce9fc75dd
Done installing documentation for rack, rack-protection, sinatra, tilt after 100 seconds
4 gems installed
 ---> 25d64864f21e
Removing intermediate container 360ce9fc75dd
Successfully built 25d64864f21e


$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              25d64864f21e        6 minutes ago       192.9 MB
ubuntu              latest              b72889fa879c        4 days ago          188 MB
jetty               latest              9f39c8e306cd        13 days ago         320.2 MB
ubuntu              15.10               4e3b13c8a266        13 days ago         136.3 MB
training/webapp     latest              6fae60ef3446        11 months ago       348.8 MB

$ docker tag 25d64864f21e ouruser/sinatra:devel
$ docker run -t -i ouruser/sinatra:devel
root@ccaec179e005:/# ls




849714f508f0866c21b4a17eda57b8fbd30744f3012474c8b6fe92e0c45fbfac
___

To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: 
>docker-machine env msangel-host

C:\Users\Vasya>docker-machine env msangel-host
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://95.213.194.178:2376
SET DOCKER_CERT_PATH=C:\Users\Vasya\.docker\machine\machines\msangel-host
SET DOCKER_MACHINE_NAME=msangel-host
REM Run this command to configure your shell:
REM     FOR /f "tokens=*" %i IN ('docker-machine env msangel-host') DO %i

C:\Users\Vasya>docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS
      NAMES
8dc2b12ea5ee        training/webapp     "python app.py"     5 minutes ago       Up 5 minutes        0.0.0.0:32768->5000/
tcp   nostalgic_bardeen

C:\Users\Vasya>docker-machine ls
NAME           ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default        -        virtualbox   Running   tcp://192.168.99.100:2376           v1.10.3
msangel-host   *        vscale       Running   tcp://95.213.194.178:2376           v1.11.0




Comments