Mageia Bugzilla – Attachment 10737 Details for
Bug 24289
docker new security issue CVE-2018-20699
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Basic introduction to docker commands
report.tut (text/plain), 7.35 KB, created by
Len Lawrence
on 2019-02-06 17:38:58 CET
(
hide
)
Description:
Basic introduction to docker commands
Filename:
MIME Type:
Creator:
Len Lawrence
Created:
2019-02-06 17:38:58 CET
Size:
7.35 KB
patch
obsolete
>$ systemctl status docker.service >â docker.service - Docker Application Container Engine > Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor prese >Active: active (running) since Tue 2019-02-05 13:33:08 GMT; 20h ago >........ >$ id >uid=1000(lcl) gid=1000(lcl) groups=1000(lcl),946(qarepo),954(vboxusers),955(docker) >$ docker version >Client: > Version: 18.06.0-dev > API version: 1.38 > Go version: go1.11.1 >[...] >Server: > Engine: > Version: dev > API version: 1.38 (minimum version 1.12) >[...] >$ docker run debian echo "Hello World" >Hello World > >Run a shell inside the container: >$ docker run -i -t debian /bin/bash >root@f3a6c63cdbcf:/# echo "Inside debian container" >Inside debian container >root@f1c9cd1351c9:/# ls >bin dev home lib64 mnt proc run srv tmp var >boot etc lib media opt root sbin sys usr >root@f1c9cd1351c9:/# cd /home >root@f1c9cd1351c9:/home# ls >root@f1c9cd1351c9:/home# exit >exit > >$ docker ps >CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES >[lcl@difda:1 data]$ docker ps -a >CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES >6bd37d66e06e debian "/bin/bash" 4 minutes ago Exited (0) 4 minutes ago gifted_bohr >bb9879f7874b debian "echo 'Hello World'" 6 minutes ago Exited (0) 6 minutes ago wizardly_ride >5504fae8075d debian "/bin/bash" 3 months ago Exited (127) 3 months ago zealous_pare >9c1936892ba0 debian "/bin/bash" 3 months ago Exited (0) 3 months ago stoic_pike >78b0b71b284c debian "echo 'Hello World'" 3 months ago Exited (0) 3 months ago friendly_elion >67c51ec82d52 debian "/bin/bash" 3 months ago Exited (255) 3 months ago festive_ride >bd969659f1f9 debian "/bin/bash" 3 months ago Exited (0) 3 months ago youthful_mirzakhani >339a1df5e2ca debian "echo 'Hello World'" 3 months ago Exited (0) 3 months ago optimistic_heisenberg >644fa8615b6f debian "echo 'Hello World'" 3 months ago Exited (0) 3 months ago distracted_euler >3c5d456e7273 hello-world "/hello" 3 months ago Exited (0) 3 months ago jovial_roentgen >848b5e35f2af hello-world "/hello" 3 months ago Exited (0) 3 months ago lucid_mayer > >Remove all old containers: >$ docker rm -v $(docker ps -aq -f status=exited) >6bd37d66e06e >bb9879f7874b >5504fae8075d >9c1936892ba0 >78b0b71b284c >67c51ec82d52 >bd969659f1f9 >339a1df5e2ca >644fa8615b6f >3c5d456e7273 >848b5e35f2af >$ docker ps -a >CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES > >$ docker run -h Diphda -i -t debian /bin/bash >root@Diphda:/# ls /bin >bash domainname login ping4 stty which >cat echo ls ping6 su ypdomainname >chgrp egrep lsblk pwd sync zcat >chmod false mkdir rbash tailf zcmp >[...] > >In another terminal, leaving Diphda running: >$ docker ps >CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES >d08656735d3c debian "/bin/bash" 20 seconds ago Up 20 seconds tender_carson > >$ docker inspect tender_carson >[ > { > "Id": "d08656735d3c8d32c8e5fe0085152fb44eb677115906ff9484fd7fbf7c241554", > "Created": "2019-02-06T15:05:37.29421156Z", > "Path": "/bin/bash", >[...lots of information...] > >$ docker inspect tender_carson | grep IPAddress > "SecondaryIPAddresses": null, > "IPAddress": "172.17.0.3", > >or > >$ docker inspect --format {{.NetworkSettings.MacAddress}} tender_carson >02:42:ac:11:00:03 > >$ docker diff tender_carson > >$ docker pull redis >Using default tag: latest >latest: Pulling from library/redis >6ae821421a7d: Pull complete >e3717477b42d: Pull complete >8e70bf6cc2e6: Pull complete >0f84ab76ce60: Pull complete >0903bdecada2: Pull complete >492876061fbd: Pull complete >Digest: sha256:6d73a4b190a631756f0fe71e571bf911275d15fbc8032f924a3db8b1bc64f603 >Status: Downloaded newer image for redis:latest >$ docker run --name diphda -d redis:latest >86cf6a564b99018a40572cdd123756e060cab62a4509555828d3d662c310cc6a > >Move to another terminal and link another redis container to the original : >$ docker run --rm -it --link diphda:redis redis /bin/bash >root@0d2980f1ebe5:/data# redis-cli -h redis -p 6379 >redis:6379> ping >PONG >redis:6379> set "abc" 456 >OK >redis:6379> get "abc" >"456" >redis:6379> exit >root@0d2980f1ebe5:/data#exit >exit > >$ docker info >returns a lot of system information and ends with these warnings: >WARNING: No memory limit support >WARNING: No swap limit support >WARNING: No kernel memory limit support >WARNING: No oom kill disable support > >Containers can be renamed easily: >$ docker ps -a >2ce141353ad8 redis:latest "docker-entrypoint.sâ¦" 27 minutes ago Up 27 minutes 6379/tcp alpha >86cf6a564b99 redis:latest "docker-entrypoint.sâ¦" 6 hours ago Up 6 hours 6379/tcp diphda >$ docker rename "diphda" "wedgewood" >$ docker ps -a >2ce141353ad8 redis:latest "docker-entrypoint.sâ¦" 28 minutes ago Up 28 minutes 6379/tcp alpha >86cf6a564b99 redis:latest "docker-entrypoint.sâ¦" 6 hours ago Up 6 hours 6379/tcp wedgewood > >Import files from upstream: >$ docker run -it --name cowsay --hostname cowsay debian bash >root@cowsay:/# apt-get update >[...] >Reading package lists... Done >root@cowsay:/# apt-get install -y cowsay fortune >[...] >root@cowsay:/# /usr/games/fortune | /usr/games/cowsay > ________________________________________ >/ Keep emotionally active. Cater to your \ >\ favorite neurosis. / > ---------------------------------------- > \ ^__^ > \ (oo)\_______ > (__)\ )\/\ > ||----w | > || || >root@cowsay:/# exit >exit > >Turn this container into an image: >$ docker commit cowsay test/cowsayimage >sha256:81661fe765c4718e2f743f85a706c2b9ba682e77be561ac5d3241ff093bea0bf >$ docker run test/cowsayimage /usr/games/cowsay "Moo" > _____ >< Moo > > ----- > \ ^__^ > \ (oo)\_______ > (__)\ )\/\ > ||----w | > || || > > >Building images from Dockerfiles: >$ mkdir cowsay >$ cd cowsay >$ edit Dockerfile >$ cat Dockerfile >FROM debian:wheezy > >RUN apt-get update && apt-get install -y cowsay fortune >$ docker build -t test/cowsay-dockerfile . >Sending build context to Docker daemon 3.072kB >Step 1/2 : FROM debian:wheezy >wheezy: Pulling from library/debian >2eaed095b90d: Pull complete >[...] >Successfully built 2fdf5212949c >Successfully tagged test/cowsay-dockerfile:latest > >$ docker run test/cowsay-dockerfile /usr/games/cowsay "Burp" >[...] > >Stopping there - the documentaion runs to another 300 pages... >
$ systemctl status docker.service â docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor prese Active: active (running) since Tue 2019-02-05 13:33:08 GMT; 20h ago ........ $ id uid=1000(lcl) gid=1000(lcl) groups=1000(lcl),946(qarepo),954(vboxusers),955(docker) $ docker version Client: Version: 18.06.0-dev API version: 1.38 Go version: go1.11.1 [...] Server: Engine: Version: dev API version: 1.38 (minimum version 1.12) [...] $ docker run debian echo "Hello World" Hello World Run a shell inside the container: $ docker run -i -t debian /bin/bash root@f3a6c63cdbcf:/# echo "Inside debian container" Inside debian container root@f1c9cd1351c9:/# ls bin dev home lib64 mnt proc run srv tmp var boot etc lib media opt root sbin sys usr root@f1c9cd1351c9:/# cd /home root@f1c9cd1351c9:/home# ls root@f1c9cd1351c9:/home# exit exit $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [lcl@difda:1 data]$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6bd37d66e06e debian "/bin/bash" 4 minutes ago Exited (0) 4 minutes ago gifted_bohr bb9879f7874b debian "echo 'Hello World'" 6 minutes ago Exited (0) 6 minutes ago wizardly_ride 5504fae8075d debian "/bin/bash" 3 months ago Exited (127) 3 months ago zealous_pare 9c1936892ba0 debian "/bin/bash" 3 months ago Exited (0) 3 months ago stoic_pike 78b0b71b284c debian "echo 'Hello World'" 3 months ago Exited (0) 3 months ago friendly_elion 67c51ec82d52 debian "/bin/bash" 3 months ago Exited (255) 3 months ago festive_ride bd969659f1f9 debian "/bin/bash" 3 months ago Exited (0) 3 months ago youthful_mirzakhani 339a1df5e2ca debian "echo 'Hello World'" 3 months ago Exited (0) 3 months ago optimistic_heisenberg 644fa8615b6f debian "echo 'Hello World'" 3 months ago Exited (0) 3 months ago distracted_euler 3c5d456e7273 hello-world "/hello" 3 months ago Exited (0) 3 months ago jovial_roentgen 848b5e35f2af hello-world "/hello" 3 months ago Exited (0) 3 months ago lucid_mayer Remove all old containers: $ docker rm -v $(docker ps -aq -f status=exited) 6bd37d66e06e bb9879f7874b 5504fae8075d 9c1936892ba0 78b0b71b284c 67c51ec82d52 bd969659f1f9 339a1df5e2ca 644fa8615b6f 3c5d456e7273 848b5e35f2af $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $ docker run -h Diphda -i -t debian /bin/bash root@Diphda:/# ls /bin bash domainname login ping4 stty which cat echo ls ping6 su ypdomainname chgrp egrep lsblk pwd sync zcat chmod false mkdir rbash tailf zcmp [...] In another terminal, leaving Diphda running: $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d08656735d3c debian "/bin/bash" 20 seconds ago Up 20 seconds tender_carson $ docker inspect tender_carson [ { "Id": "d08656735d3c8d32c8e5fe0085152fb44eb677115906ff9484fd7fbf7c241554", "Created": "2019-02-06T15:05:37.29421156Z", "Path": "/bin/bash", [...lots of information...] $ docker inspect tender_carson | grep IPAddress "SecondaryIPAddresses": null, "IPAddress": "172.17.0.3", or $ docker inspect --format {{.NetworkSettings.MacAddress}} tender_carson 02:42:ac:11:00:03 $ docker diff tender_carson $ docker pull redis Using default tag: latest latest: Pulling from library/redis 6ae821421a7d: Pull complete e3717477b42d: Pull complete 8e70bf6cc2e6: Pull complete 0f84ab76ce60: Pull complete 0903bdecada2: Pull complete 492876061fbd: Pull complete Digest: sha256:6d73a4b190a631756f0fe71e571bf911275d15fbc8032f924a3db8b1bc64f603 Status: Downloaded newer image for redis:latest $ docker run --name diphda -d redis:latest 86cf6a564b99018a40572cdd123756e060cab62a4509555828d3d662c310cc6a Move to another terminal and link another redis container to the original : $ docker run --rm -it --link diphda:redis redis /bin/bash root@0d2980f1ebe5:/data# redis-cli -h redis -p 6379 redis:6379> ping PONG redis:6379> set "abc" 456 OK redis:6379> get "abc" "456" redis:6379> exit root@0d2980f1ebe5:/data#exit exit $ docker info returns a lot of system information and ends with these warnings: WARNING: No memory limit support WARNING: No swap limit support WARNING: No kernel memory limit support WARNING: No oom kill disable support Containers can be renamed easily: $ docker ps -a 2ce141353ad8 redis:latest "docker-entrypoint.sâ¦" 27 minutes ago Up 27 minutes 6379/tcp alpha 86cf6a564b99 redis:latest "docker-entrypoint.sâ¦" 6 hours ago Up 6 hours 6379/tcp diphda $ docker rename "diphda" "wedgewood" $ docker ps -a 2ce141353ad8 redis:latest "docker-entrypoint.sâ¦" 28 minutes ago Up 28 minutes 6379/tcp alpha 86cf6a564b99 redis:latest "docker-entrypoint.sâ¦" 6 hours ago Up 6 hours 6379/tcp wedgewood Import files from upstream: $ docker run -it --name cowsay --hostname cowsay debian bash root@cowsay:/# apt-get update [...] Reading package lists... Done root@cowsay:/# apt-get install -y cowsay fortune [...] root@cowsay:/# /usr/games/fortune | /usr/games/cowsay ________________________________________ / Keep emotionally active. Cater to your \ \ favorite neurosis. / ---------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || root@cowsay:/# exit exit Turn this container into an image: $ docker commit cowsay test/cowsayimage sha256:81661fe765c4718e2f743f85a706c2b9ba682e77be561ac5d3241ff093bea0bf $ docker run test/cowsayimage /usr/games/cowsay "Moo" _____ < Moo > ----- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || Building images from Dockerfiles: $ mkdir cowsay $ cd cowsay $ edit Dockerfile $ cat Dockerfile FROM debian:wheezy RUN apt-get update && apt-get install -y cowsay fortune $ docker build -t test/cowsay-dockerfile . Sending build context to Docker daemon 3.072kB Step 1/2 : FROM debian:wheezy wheezy: Pulling from library/debian 2eaed095b90d: Pull complete [...] Successfully built 2fdf5212949c Successfully tagged test/cowsay-dockerfile:latest $ docker run test/cowsay-dockerfile /usr/games/cowsay "Burp" [...] Stopping there - the documentaion runs to another 300 pages...
View Attachment As Raw
Actions:
View
Attachments on
bug 24289
: 10737