Docker: Unterschied zwischen den Versionen

Aus robopagex.com
Zur Navigation springen Zur Suche springen
Zeile 41: Zeile 41:
 
''Image commands''
 
''Image commands''
 
     $''' docker image'''
 
     $''' docker image'''
     '''build''' #
+
     '''build'''       #
     '''history''' #
+
     '''history'''     #
     '''import''' #
+
     '''import'''       #
     '''inspect''' #
+
     '''inspect'''     #
     '''load''' #
+
     '''load'''         #
     '''ls''' #
+
     '''ls'''           #
     '''prune''' #
+
     '''prune'''       #
     '''pull''' #
+
     '''pull'''         #
     '''push''' #
+
     '''push'''         #
     '''rm''' #
+
     '''rm'''           #
     '''save''' #
+
     '''save'''         #
     '''tag''' #
+
     '''tag'''         #
  
 
<big>'''Export'''</big>
 
<big>'''Export'''</big>
Zeile 64: Zeile 64:
 
''docker run [OPTIONS] IMAGE [COMMAND] [ARG...]''
 
''docker run [OPTIONS] IMAGE [COMMAND] [ARG...]''
 
     $''' docker run '''
 
     $''' docker run '''
     '''-it''' # interactively
+
     '''-it'''                   # interactively
     '''-d''' # detached
+
     '''-d'''                   # detached
     '''-p 8080:80''' # define external port
+
     '''-p 8080:80'''           # define external port
     '''--name MYNAME''' # define container name
+
     '''--name MYNAME'''         # define container name
     '''-m 300m''' # memory limit  
+
     '''-m 300m'''               # memory limit  
     '''--memory-swap 1g''' #  
+
     '''--memory-swap 1g'''     #
     '''--cpuset-cups="1"''' #  
+
     '''--cpuset-cups="1"'''     #  
     '''-rm''' # auto remove container after exit
+
     '''-rm'''                   # auto remove container after exit
     '''--workdir "/home"''' # Any RUN , CMD , ADD , COPY , or ENTRYPOINT command will be executed in the specified working directory
+
     '''--workdir "/home"'''     # Any RUN , CMD , ADD , COPY , or ENTRYPOINT command will be executed in the specified working directory
     '''-w="/home"'''       # ^
+
     '''-w="/home"'''           # ^
 
     '''-d''' #
 
     '''-d''' #
 
     '''-d''' #
 
     '''-d''' #

Version vom 30. April 2021, 08:38 Uhr

Docker Container & Images

[Docker https://www.docker.com/]


Tutorial docker cli, docker-compose, docker swarm

Docker cli

Version

   $ docker -v
   $ docker-compose -v

System

system-wide information

   $ docker system info 

docker disk usage

   $ docker system df 

real time events from the server

   $ docker system events


Status

running containers

   $ docker ps

Images

View all Images

   $ docker images
   $ docker image list

View Image by name

   $ docker images alpine

Image commands

   $ docker image
   build        #
   history      #
   import       #
   inspect      #
   load         #
   ls           #
   prune        #
   pull         #
   push         #
   rm           #
   save         #
   tag          #

Export

export container, these commands has the same result

   $ docker export nginx > nginx_latest.tar
   $ docker export --output="nginx_latest" nginx

docker bash

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

   $ docker run 
   -it                   # interactively
   -d                    # detached
   -p 8080:80            # define external port
   --name MYNAME         # define container name
   -m 300m               # memory limit 
   --memory-swap 1g      #
   --cpuset-cups="1"     # 
   -rm                   # auto remove container after exit
   --workdir "/home"     # Any RUN , CMD , ADD , COPY , or ENTRYPOINT command will be executed in the specified working directory
   -w="/home"            # ^
   -d #
   -d #

run alpine cli sh

   $ docker run -it alpine /bin/sh

run alpine cli detached

   $ docker run -it -d --name MYALPINE -p 8080:80 alpine

run alpine cli with entrypoint

   $ docker run -it --name MYALPINE -p 8080:80 --entrypoint /bin/sh alpine


docker File

docker compose