Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
[sanse@Sprint1-Docker-vm ~]$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
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.
    (amd64)
 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

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

[sanse@Sprint1-Docker-vm ~]$


Docker를 Non Root계정으로 관리하기

Code Block
[sanse@Sprint1-Docker-vm ~]$ sudo useradd -g docker docker

[sanse@Sprint1-Docker-vm ~]$ docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/json: dial unix /var/run/docker.sock: connect: permission denied
[sanse@Sprint1-Docker-vm ~]$ sudo su - docker
[sudo] password for sanse:
[docker@Sprint1-Docker-vm ~]$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[docker@Sprint1-Docker-vm ~]$


시스템 부팅시 Docker 자동 시작하기

Code Block
[sanse@Sprint1-Docker-vm ~]$ sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[sanse@Sprint1-Docker-vm ~]$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-03-01 07:21:25 UTC; 25min ago
     Docs: https://docs.docker.com
 Main PID: 32584 (dockerd)
   CGroup: /system.slice/docker.service
           └─32584 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Mar 01 07:21:24 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:24.981249273Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange:...ule=grpc
Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.141678250Z" level=info msg="Graph migration to content-addressability to...seconds"
Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.142862154Z" level=info msg="Loading containers: start."
Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.534811366Z" level=info msg="Default bridge (docker0) is assigned with an...address"
Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.674466569Z" level=info msg="Loading containers: done."
Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.710416898Z" level=info msg="Docker daemon" commit=774a1f4 graphdriver(s)...=18.09.3
Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.710752199Z" level=info msg="Daemon has completed initialization"
Mar 01 07:21:25 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:21:25.767784405Z" level=info msg="API listen on /var/run/docker.sock"
Mar 01 07:21:25 Sprint1-Docker-vm systemd[1]: Started Docker Application Container Engine.
Mar 01 07:23:58 Sprint1-Docker-vm dockerd[32584]: time="2019-03-01T07:23:58.655294539Z" level=info msg="ignoring event" module=libcontainerd namespa...kDelete"
Hint: Some lines were ellipsized, use -l to show in full.
[sanse@Sprint1-Docker-vm ~]$