docker로 기계학습(101)환경구축(1)docker는 아무리 해도 잘못된 것이다.

운영체제의docker 명령


"Docker야, 어떻게 해도 잘못이야"할 때
순서대로 동작을 확인하는 것이 중요하다.
또 여기에 기재된 사항은 순서대로 해결한다.
여기에 추가 기재하거나 관련 URL 앞에 기재하여 다시 정리할 예정입니다.
<이 항목은 미완성입니다.순서대로 기록합니다. >

docker 명령 가져오기


'docker ps'로 확인하면 됩니다.

docker ps

$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

다음은 Mac에서 Docker 응용 프로그램을 시작하지 않았을 때입니다.
$ docker ps
Error response from daemon: dial unix vms/0/00000003.00000948: connect: connection refused

$ docker ps
Error response from daemon: Bad response from Docker engine
상술한docker 프로그램이 시작되었습니다.연결이 원활하지 않다.
OgawaKishinoMBP:~ ogawakiyoshi$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
이상은dockerps 명령이 잘 실행되었지만 docker를 시작하지 않았을 때입니다.

docker images

$ docker images
REPOSITORY                                              TAG                 IMAGE ID            CREATED             SIZE
아무것도 안 했을 때 위에 있었어.과거의 잔해가 있는 경우, 예를 들면 다음과 같다.
$ docker images
REPOSITORY                                              TAG                 IMAGE ID            CREATED             SIZE
kaizenjapan/anaconda2-willi                             <none>              65e195f7ae66        47 hours ago        4.5GB
<none>                                                  <none>              cd3ce6c61c89        2 days ago          5.66GB
<none>                                                  <none>              23cc27429c4b        2 days ago          5.66GB
<none>                                                  <none>              05a7a823de44        2 weeks ago         2.9GB
ubuntu                                                  14.04               c32fae490809        4 weeks ago         188MB
continuumio/anaconda3                                   <none>              a9090db7be5a        4 months ago        3.6GB
gcc                                                     <none>              8357b3fcbe41        6 months ago        1.64GB

docker rmi


사용하지 않는 이미지를 삭제하는 것이 가장 좋다.
$ docker rmi  65e195f7ae66
Error response from daemon: conflict: unable to delete 65e195f7ae66 (cannot be forced) - image has dependent child images

$ docker rmi 05a3bd381fc2   
Error response from daemon: conflict: unable to delete 05a3bd381fc2 (must be forced) - image is being used by stopped container 0137e4ebe13d

$ docker rmi 0137e4ebe13d
Error: No such image: 0137e4ebe13d

docker commit

$ docker commit 5e6115003e9f kaizenjapan/anaconda-nikhil 
Error response from daemon: Error processing tar file(exit status 1): write /opt/conda/lib/python3.6/site-packages/PyQt5/Qt/lib/libQt5WebEngineCore.so.5: no space left on device

docker pull

docker pull kaizenjapan/anaconda-keras
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/kaizenjapan/anaconda-keras/manifests/latest: unauthorized: incorrect username or password

docker login

$ docker login
Authenticating with existing credentials...
Stored credentials invalid or expired
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username ([email protected]):      
Password: 
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password
왜 그런지 인터넷에서hub.docker.com에 로그인해서 넣었어요.

docker run

$ docker run -it -p 8888:8888 kaizenjapan/r-keras
Unable to find image 'kaizenjapan/r-keras:latest' locally
latest: Pulling from kaizenjapan/r-keras
cc1a78bfd46b: Pull complete 
314b82d3c9fe: Pull complete 
adebea299011: Extracting [==================================================>]  1.491GB/1.491GB
f7baff790e81: Download complete 
44c478e462a0: Download complete 
3adc51af53a0: Download complete 
docker: failed to register layer: Error processing tar file(exit status 1: unpigz: skipping: <stdin>: corrupted -- crc32 mismatch
): .
See 'docker run --help'.

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

Run a command in a new container

Options:
      --add-host list                  Add a custom host-to-IP mapping (host:ip)
  -a, --attach list                    Attach to STDIN, STDOUT or STDERR
      --blkio-weight uint16            Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
      --blkio-weight-device list       Block IO weight (relative device weight) (default [])
      --cap-add list                   Add Linux capabilities
      --cap-drop list                  Drop Linux capabilities
      --cgroup-parent string           Optional parent cgroup for the container
      --cidfile string                 Write the container ID to the file
      --cpu-period int                 Limit CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int                  Limit CPU CFS (Completely Fair Scheduler) quota
      --cpu-rt-period int              Limit CPU real-time period in microseconds
      --cpu-rt-runtime int             Limit CPU real-time runtime in microseconds
  -c, --cpu-shares int                 CPU shares (relative weight)
      --cpus decimal                   Number of CPUs
      --cpuset-cpus string             CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string             MEMs in which to allow execution (0-3, 0,1)
  -d, --detach                         Run container in background and print container ID
      --detach-keys string             Override the key sequence for detaching a container
      --device list                    Add a host device to the container
      --device-cgroup-rule list        Add a rule to the cgroup allowed devices list
      --device-read-bps list           Limit read rate (bytes per second) from a device (default [])
      --device-read-iops list          Limit read rate (IO per second) from a device (default [])
      --device-write-bps list          Limit write rate (bytes per second) to a device (default [])
      --device-write-iops list         Limit write rate (IO per second) to a device (default [])
      --disable-content-trust          Skip image verification (default true)
      --dns list                       Set custom DNS servers
      --dns-option list                Set DNS options
      --dns-search list                Set custom DNS search domains
      --entrypoint string              Overwrite the default ENTRYPOINT of the image
  -e, --env list                       Set environment variables
      --env-file list                  Read in a file of environment variables
      --expose list                    Expose a port or a range of ports
      --group-add list                 Add additional groups to join
      --health-cmd string              Command to run to check health
      --health-interval duration       Time between running the check (ms|s|m|h) (default 0s)
      --health-retries int             Consecutive failures needed to report unhealthy
      --health-start-period duration   Start period for the container to initialize before starting health-retries countdown (ms|s|m|h)
                                       (default 0s)
      --health-timeout duration        Maximum time to allow one check to run (ms|s|m|h) (default 0s)
      --help                           Print usage
  -h, --hostname string                Container host name
      --init                           Run an init inside the container that forwards signals and reaps processes
  -i, --interactive                    Keep STDIN open even if not attached
      --ip string                      IPv4 address (e.g., 172.30.100.104)
      --ip6 string                     IPv6 address (e.g., 2001:db8::33)
      --ipc string                     IPC mode to use
      --isolation string               Container isolation technology
      --kernel-memory bytes            Kernel memory limit
  -l, --label list                     Set meta data on a container
      --label-file list                Read in a line delimited file of labels
      --link list                      Add link to another container
      --link-local-ip list             Container IPv4/IPv6 link-local addresses
      --log-driver string              Logging driver for the container
      --log-opt list                   Log driver options
      --mac-address string             Container MAC address (e.g., 92:d0:c6:0a:29:33)
  -m, --memory bytes                   Memory limit
      --memory-reservation bytes       Memory soft limit
      --memory-swap bytes              Swap limit equal to memory plus swap: '-1' to enable unlimited swap
      --memory-swappiness int          Tune container memory swappiness (0 to 100) (default -1)
      --mount mount                    Attach a filesystem mount to the container
      --name string                    Assign a name to the container
      --network string                 Connect a container to a network (default "default")
      --network-alias list             Add network-scoped alias for the container
      --no-healthcheck                 Disable any container-specified HEALTHCHECK
      --oom-kill-disable               Disable OOM Killer
      --oom-score-adj int              Tune host's OOM preferences (-1000 to 1000)
      --pid string                     PID namespace to use
      --pids-limit int                 Tune container pids limit (set -1 for unlimited)
      --platform string                Set platform if server is multi-platform capable
      --privileged                     Give extended privileges to this container
  -p, --publish list                   Publish a container's port(s) to the host
  -P, --publish-all                    Publish all exposed ports to random ports
      --read-only                      Mount the container's root filesystem as read only
      --restart string                 Restart policy to apply when a container exits (default "no")
      --rm                             Automatically remove the container when it exits
      --runtime string                 Runtime to use for this container
      --security-opt list              Security Options
      --shm-size bytes                 Size of /dev/shm
      --sig-proxy                      Proxy received signals to the process (default true)
      --stop-signal string             Signal to stop a container (default "SIGTERM")
      --stop-timeout int               Timeout (in seconds) to stop a container
      --storage-opt list               Storage driver options for the container
      --sysctl map                     Sysctl options (default map[])
      --tmpfs list                     Mount a tmpfs directory
  -t, --tty                            Allocate a pseudo-TTY
      --ulimit ulimit                  Ulimit options (default [])
  -u, --user string                    Username or UID (format: <name|uid>[:<group|gid>])
      --userns string                  User namespace to use
      --uts string                     UTS namespace to use
  -v, --volume list                    Bind mount a volume
      --volume-driver string           Optional volume driver for the container
      --volumes-from list              Mount volumes from the specified container(s)
  -w, --workdir string                 Working directory inside the container

Macintosh


docker 아이콘을 눌렀을 때 다음 오류가 발생했습니다.

Diagnose & Feedback 누르기

지정한 명령을 실행해 보십시오.
$ /Applications/Docker.app/Contents/Resources/bin/docker-diagnose -u
macOS: version 10.12.6 (build: 16G1036)
Docker.app: version: 18.03.1-ce-mac65 (dd2831d4b7421cf559a0881cc7a5fdebeb8c2b98)
Local time: 2018年 10月 9日 火曜日 11時39分35秒 JST
UTC:        2018年 10月 9日 火曜日 02時39分35秒 UTC
Timestamp:  20181009-113935
Running diagnostic tests:
[OK]      Files
[ERROR]   Docker CLI       Connection refused (ECONNREFUSED) connecting to /var/run/docker.sock: check if service is running
[ERROR]   Docker CLI       Connection refused (ECONNREFUSED) connecting to /Users/administrator/Library/Containers/com.docker.docker/Data/s60: check if service is running
Error docker ps: timeout after 10.00s
[ERROR]   docker-cli       docker ps failed: (Failure "docker ps: timeout after 10.00s")
[OK]      Moby booted
[ERROR]   driver.amd64-linux com.docker.driver.amd64-linux is not running
[OK]      vmnetd
[ERROR]   osxfs            com.docker.osxfs is not running
[ERROR]   VPNKit           Unexpected error ((Failure
  "Error connecting socket to 9p endpoint unix:/Users/administrator/Library/Containers/com.docker.docker/Data/s51: Unix.Unix_error(Unix.ECONNREFUSED, \"connect\", \"\")")) connecting to /Users/administrator/Library/Containers/com.docker.docker/Data/s51
[ERROR]   VPNKit           com.docker.vpnkit is not running
Error docker ps: got timeout (docker ps: exit 1)




이유를 모르다.재진단
$ /Applications/Docker.app/Contents/Resources/bin/docker-diagnose -u
macOS: version 10.12.6 (build: 16G1036)
Docker.app: version: 18.03.1-ce-mac65 (dd2831d4b7421cf559a0881cc7a5fdebeb8c2b98)
Local time: 2018年 10月 9日 火曜日 11時51分17秒 JST
UTC:        2018年 10月 9日 火曜日 02時51分17秒 UTC
Timestamp:  20181009-115117
Running diagnostic tests:
[OK]      Files
[ERROR]   Docker CLI       cannot find docker
[ERROR]   Docker CLI       /var/run/docker.sock does not exist
[ERROR]   Docker CLI       Unexpected error (No such file or directory) connecting to /var/run/docker.sock
[ERROR]   Docker CLI       /Users/administrator/Library/Containers/com.docker.docker/Data/s60 does not exist
[ERROR]   Docker CLI       Unexpected error (No such file or directory) connecting to /Users/administrator/Library/Containers/com.docker.docker/Data/s60
Error docker ps: timeout after 10.00s
[ERROR]   docker-cli       docker ps failed: (Failure "docker ps: timeout after 10.00s")
[ERROR]   Moby booted      /Users/administrator/Library/Containers/com.docker.docker/Data/vms/0/console-ring does not exist
[ERROR]   driver.amd64-linux com.docker.driver.amd64-linux is not running
[ERROR]   vmnetd           /var/tmp/com.docker.vmnetd.socket does not exist
[ERROR]   vmnetd           Unexpected error (No such file or directory) connecting to /var/tmp/com.docker.vmnetd.socket
[ERROR]   vmnetd           /private/tmp/vmnetd/com.docker.vmnetd is not running
[ERROR]   osxfs            com.docker.osxfs is not running
[ERROR]   VPNKit           Unexpected error ((Failure
  "Error connecting socket to 9p endpoint unix:/Users/administrator/Library/Containers/com.docker.docker/Data/s51: Unix.Unix_error(Unix.ENOENT, \"connect\", \"\")")) connecting to /Users/administrator/Library/Containers/com.docker.docker/Data/s51
[ERROR]   VPNKit           com.docker.vpnkit is not running
Error docker ps: got timeout (docker ps: exit 127)
[ERROR]   disk             No Docker.qcow2 or Docker.raw found: the VM has never been started
[OK]      environment
[OK]      Docker
[OK]      VT-x
[OK]      kern.hv_support
Most specific failure is: No Docker.qcow2 or Docker.raw found: the VM has never been started
Docker logs are being collected into /tmp/「なんやらいっぱい数字がならんでる。」/20181009-115117.tar.gz
Your unique id is: 「なんやらいっぱい数字がならんでる。」
Please quote this in all correspondence.
$ /Applications/Docker.app/Contents/Resources/bin/docker-diagnose -u
macOS: version 10.12.6 (build: 16G1036)
Docker.app: version: 18.03.1-ce-mac65 (dd2831d4b7421cf559a0881cc7a5fdebeb8c2b98)
Local time: 2018年 10月 9日 火曜日 11時58分28秒 JST
UTC:        2018年 10月 9日 火曜日 02時58分28秒 UTC
Timestamp:  20181009-115828
Running diagnostic tests:
[OK]      Files
[OK]      Docker CLI
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      VPNKit
[OK]      disk
[OK]      environment
[OK]      Docker
[OK]      VT-x
[OK]      kern.hv_support
Docker logs are being collected into /tmp/「なんやらいっぱい数字がならんでる。」/20181009-115828.tar.gz
Your unique id is: 「「なんやらいっぱい数字がならんでる。」」
Please quote this in all correspondence.

Windows


Docker for Windows
https://qiita.com/kaizen_nagoya/items/c4daa5cf52e9f0c2c002
시스템 관리자 권한
Hyper-V 설정
네트워크 설정(보안)
시스템 설정 설정
등 게재.

참고 문헌


Docker에서 호스트와 컨테이너 간에 파일 복사
https://qiita.com/gologo13/items/7e4e404af80377b48fd5
docker 시작
https://qiita.com/kaizen_nagoya/items/2f31319e40ddaa0bf8a5
<이 글은 개인의 과거 경험을 바탕으로 한 개인적인 감상이다.현재 소속된 조직, 업무와는 무관합니다.>

문서 기록


ver. 0.10 초고 20181008
ver. 0.11 commit 추기 20181009 아침
ver. 0.12 윈도우즈, 맥 추적 20181009 오전
ver. 0.13 docker hub 추기 20181009 낮
ver. 0.14 오류 처리 방법 등 20181010 추적 중
ver. 0.15 보충설명 20181011
ver. 0.16호 변경, 참고 문헌 추기 20181027
ver. 0.17 docker run error 추론 20181028

좋은 웹페이지 즐겨찾기