docker-compose에서 No such file or directory가 되어 반복적으로 시험해 본다면

26061 단어 Docker초학자tech
우여곡절을 겪었기 때문에 남는 것을 기억해야 한다.
  • 옆에 있는 PC에서 용기를 만들었는데 그 안에 Docker Desktop 2.30.3+WSL1
  • 이 들어 있었다.
  • export DOCKER_HOST=tcp://localhost:2375까먹었어
  • docker version에 서버 정보가 되돌아오지 않는 이유
    이것은 이런 상황의 비결에 근거하여 기록한 것이다.
    (호스트 이름을 보고 싶지 않으므로 적절히 교체됩니다.)
  • docker
    https://qiita.com/yuta-ushijima/items/d3d98177e1b28f736f04
    아래 compose 보시면서.
    version: '2'
    services:
      db:
        image: mysql
      web:
        build: .
        command: bundle exec rails s -p 3000 -b '0.0.0.0'
        volumes:
          - .:/myapp
        ports:
          - "3000:3000"
        depends_on:
          - db
    
    노스 파일 or directory와 함께 나왔어요.
    konny@localhost:/mnt/c/private/container/localenv_d4x$ docker-compose up -d
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
        chunked=chunked)
      File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 357, in _make_request
        conn.request(method, url, **httplib_request_kw)
      File "/usr/lib/python3.6/http/client.py", line 1281, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
        self.endheaders(body, encode_chunked=encode_chunked)
      File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
        self._send_output(message_body, encode_chunked=encode_chunked)
      File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
        self.send(msg)
      File "/usr/lib/python3.6/http/client.py", line 980, in send
        self.connect()
      File "/usr/local/lib/python3.6/dist-packages/docker/transport/unixconn.py", line 43, in connect
        sock.connect(self.unix_socket)
    FileNotFoundError: [Errno 2] No such file or directory
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 449, in send
        timeout=timeout
      File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
        _stacktrace=sys.exc_info()[2])
      File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 367, in increment
        raise six.reraise(type(error), error, _stacktrace)
      File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise
        raise value.with_traceback(tb)
      File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
        chunked=chunked)
      File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 357, in _make_request
        conn.request(method, url, **httplib_request_kw)
      File "/usr/lib/python3.6/http/client.py", line 1281, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
        self.endheaders(body, encode_chunked=encode_chunked)
      File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
        self._send_output(message_body, encode_chunked=encode_chunked)
      File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
        self.send(msg)
      File "/usr/lib/python3.6/http/client.py", line 980, in send
        self.connect()
      File "/usr/local/lib/python3.6/dist-packages/docker/transport/unixconn.py", line 43, in connect
        sock.connect(self.unix_socket)
    urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 205, in _retrieve_server_version
        return self.version(api_version=False)["ApiVersion"]
      File "/usr/local/lib/python3.6/dist-packages/docker/api/daemon.py", line 181, in version
        return self._result(self._get(url), json=True)
      File "/usr/local/lib/python3.6/dist-packages/docker/utils/decorators.py", line 46, in inner
        return f(self, *args, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 228, in _get
        return self.get(url, **self._set_request_timeout(kwargs))
      File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 543, in get
        return self.request('GET', url, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 530, in request
        resp = self.send(prep, **send_kwargs)
      File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 643, in send
        r = adapter.send(request, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 498, in send
        raise ConnectionError(err, request=request)
    requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/bin/docker-compose", line 8, in <module>
        sys.exit(main())
      File "/usr/local/lib/python3.6/dist-packages/compose/cli/main.py", line 67, in main
        command()
      File "/usr/local/lib/python3.6/dist-packages/compose/cli/main.py", line 123, in perform_command
        project = project_from_options('.', options)
      File "/usr/local/lib/python3.6/dist-packages/compose/cli/command.py", line 69, in project_from_options
        environment_file=environment_file
      File "/usr/local/lib/python3.6/dist-packages/compose/cli/command.py", line 132, in get_project
        verbose=verbose, version=api_version, context=context, environment=environment
      File "/usr/local/lib/python3.6/dist-packages/compose/cli/docker_client.py", line 43, in get_client
        environment=environment, tls_version=get_tls_version(environment)
      File "/usr/local/lib/python3.6/dist-packages/compose/cli/docker_client.py", line 170, in docker_client
        client = APIClient(**kwargs)
      File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 188, in __init__
        self._version = self._retrieve_server_version()
      File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 213, in _retrieve_server_version
        'Error while fetching server API version: {0}'.format(e)
    docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
    
    파일이 없습니까?
    유사한 오류를 냈을 때, 어째서 누군가가 권한을 언급했는지 모르겠다
    https://qiita.com/DQNEO/items/da5df074c48b012152ee
    실시 방안
    근데 틀린 내용은 변함이 없어요.
    만일을 대비하다
    konny@localhost:/mnt/c/private/container/localenv_d4x$ docker-compose version
    docker-compose version 1.27.4, build unknown
    docker-py version: 4.3.1
    CPython version: 3.6.9
    OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
    konny@localhost:/mnt/c/private/container/localenv_d4x$
    
    그렇게 오래되지는 않은 것 같아요.
    docker 프로그램을 다시 시작해도 상황은 바뀌지 않습니다
    yml만 더 얹고 다시 실행해도 변하지 않는다.
    일단 명령 appt-get을 사용해볼게요.
    변함이 없다
    konny@localhost::/mnt/c/private/container/test_container$ sudo apt install docker-compose
    konny@localhost::/mnt/c/private/container/test_container$ docker-compose version
    docker-compose version 1.27.4, build unknown
    docker-py version: 4.3.1
    CPython version: 3.6.9
    OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
    konny@localhost:/mnt/c/private/container/test_container$
    
    아래 내용을 참고하여 최신화
    https://qiita.com/kottyan/items/c892b525b14f293ab7b3
    konny@localhost:/mnt/c/private/container/test_container$ docker-compose version
    docker-compose version 1.27.4, build unknown
    docker-py version: 4.3.1
    CPython version: 3.6.9
    OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
    konny@localhost:/mnt/c/private/container/test_container$ ls -l /usr/local/bin/docker-compose
    -rwxr-xr-x 1 root root 215 Oct 15  2020 /usr/local/bin/docker-compose
    konny@localhost:/mnt/c/private/container/test_container$ sudo rm -rf docker-compose
    konny@localhost:/mnt/c/private/container/test_container$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   633  100   633    0     0   2096      0 --:--:-- --:--:-- --:--:--  2089
    100 12.1M  100 12.1M    0     0  10.9M      0  0:00:01  0:00:01 --:--:-- 10.9M
    konny@localhost:/mnt/c/private/container/test_container$ sudo chmod +x /usr/local/bin/docker-compose
    konny@localhost:/mnt/c/private/container/test_container$ docker-compose -v
    docker-compose version 1.29.1, build c34c88b2
    konny@localhost:/mnt/c/private/container/test_container$ docker-compose version
    docker-compose version 1.29.1, build c34c88b2
    docker-py version: 5.0.0
    CPython version: 3.7.10
    OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
    konny@localhost:/mnt/c/private/container/test_container$
    
    재집행
    틀린 말은 쉬워졌을 뿐, 한 말은 변하지 않았다.
    konny@localhost:/mnt/c/private/container/test_container$ docker-compose up -d
    Traceback (most recent call last):
      File "urllib3/connectionpool.py", line 677, in urlopen
      File "urllib3/connectionpool.py", line 392, in _make_request
      File "http/client.py", line 1277, in request
      File "http/client.py", line 1323, in _send_request
      File "http/client.py", line 1272, in endheaders
      File "http/client.py", line 1032, in _send_output
      File "http/client.py", line 972, in send
      File "docker/transport/unixconn.py", line 43, in connect
    FileNotFoundError: [Errno 2] No such file or directory
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "requests/adapters.py", line 449, in send
      File "urllib3/connectionpool.py", line 727, in urlopen
      File "urllib3/util/retry.py", line 410, in increment
      File "urllib3/packages/six.py", line 734, in reraise
      File "urllib3/connectionpool.py", line 677, in urlopen
      File "urllib3/connectionpool.py", line 392, in _make_request
      File "http/client.py", line 1277, in request
      File "http/client.py", line 1323, in _send_request
      File "http/client.py", line 1272, in endheaders
      File "http/client.py", line 1032, in _send_output
      File "http/client.py", line 972, in send
      File "docker/transport/unixconn.py", line 43, in connect
    urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "docker/api/client.py", line 214, in _retrieve_server_version
      File "docker/api/daemon.py", line 181, in version
      File "docker/utils/decorators.py", line 46, in inner
      File "docker/api/client.py", line 237, in _get
      File "requests/sessions.py", line 543, in get
      File "requests/sessions.py", line 530, in request
      File "requests/sessions.py", line 643, in send
      File "requests/adapters.py", line 498, in send
    requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "docker-compose", line 3, in <module>
      File "compose/cli/main.py", line 81, in main
      File "compose/cli/main.py", line 200, in perform_command
      File "compose/cli/command.py", line 70, in project_from_options
      File "compose/cli/command.py", line 153, in get_project
      File "compose/cli/docker_client.py", line 43, in get_client
      File "compose/cli/docker_client.py", line 170, in docker_client
      File "docker/api/client.py", line 197, in __init__
      File "docker/api/client.py", line 222, in _retrieve_server_version
    docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
    [9582] Failed to execute script docker-compose
    konny@localhost:/mnt/c/private/container/test_container$ 
    
    docker 수호 프로세스의 상태가 좋지 않습니까?그렇게 생각했지만 변함이 없었어요
    말하자면 리셋을 많이 했으니까 괜찮겠죠.
    https://file-translate.com/ja/blog/docker-can-not-start-on-windows
    WSL1이 나쁜 건가요?
    Docker 프로그램이 낡아서 안 좋아요?
    업데이트 좀 하고 싶은데.
    업무 중에 사용하기 때문에 변경할 때 긴장합니다.
    아직 안 끝났어요.
    단발 명령이면 프로그램과 CLI가 보는 sock이 다르다고요?
    konny@localhost:/mnt/c/Private/container/test_container$ docker run -dp 80:80 docker/getting-started
    docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
    See 'docker run --help'.
    
    다시 분리, dockerdaemon이 시작되지 않은 것 같아서 비슷한 명령으로 시작하기
    시작했지만 서버가 없습니다.
    나는 무엇을 가동시켰는지 모르겠다.
    konny@localhost:/mnt/c/Private/container/test_container$ sudo service docker start
    [sudo] password for kana-k:
     * Starting Docker: docker                                                                                                                                                                                                                                              [ OK ]
    konny@localhost:/mnt/c/Private/container/test_container$ docker version
    Client: Docker Engine - Community
     Version:           20.10.5
     API version:       1.41
     Go version:        go1.13.15
     Git commit:        55c4c88
     Built:             Tue Mar  2 20:18:05 2021
     OS/Arch:           linux/amd64
     Context:           default
     Experimental:      true
    Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
    
    그럼 원래 없어?
    앱으로 받을 수 있습니까? → 안 됩니다.WSL이 오래돼서 그런가 봐요.
    konny@localhost:/mnt/c/Private/container/test_container$ sudo apt install docker.io
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     docker.io : Depends: containerd (>= 1.2.6-0ubuntu1~)
    E: Unable to correct problems, you have held broken packages.
    konny@localhost:/mnt/c/Private/container/test_container$
    
    그렇다면 WSL1은 Docker를 어떻게 사용합니까
    https://djeeeno.blogspot.com/2019/06/20190616-01-docker-on-wsl.html
    그러고 보니까 이런 설정이 있더라고요.
  • 작업 트레이 아이콘의 Docker→Settings에서 설정 열기
  • □ Expose daemon on tcp://localhost:2375without TLS
  • 확인
  • DOCKER_Windows용 Docker 환경 변수 가리키기
    export DOCKER_HOST=tcp://localhost:2375
  • 샤오제가 너였구나.
    도커 데몬을 자꾸 옮겨주는 건 (대본에 문제가 있어서 까먹었어요)
    konny@localhost:/mnt/c/Private/container/test_container$ export DOCKER_HOST=tcp://localhost:2375
    konny@localhost:/mnt/c/Private/container/test_container$ docker version
    Client: Docker Engine - Community
     Version:           20.10.5
     API version:       1.40
     Go version:        go1.13.15
     Git commit:        55c4c88
     Built:             Tue Mar  2 20:18:05 2021
     OS/Arch:           linux/amd64
     Context:           default
     Experimental:      true
    
    Server: Docker Engine - Community
     Engine:
      Version:          19.03.8
      API version:      1.40 (minimum version 1.12)
      Go version:       go1.12.17
      Git commit:       afacb8b
      Built:            Wed Mar 11 01:29:16 2020
      OS/Arch:          linux/amd64
      Experimental:     false
     containerd:
      Version:          v1.2.13
      GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
     runc:
      Version:          1.0.0-rc10
      GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
     docker-init:
      Version:          0.18.0
      GitCommit:        fec3683
    konny@localhost:/mnt/c/Private/container/test_container$
    
    다시 실행하면 오류를 토하면서 시작하는 바람의 일지가 나타납니다!
    여전히 오류지만 DB가 성공적으로 시작된 것 같습니다.
    그 다음에 yaml과 PATH를 수정하면 됩니다.🙌
    konny@localhost:/mnt/c/Private/container/test_container$ docker-compose up
    WARNING: Found orphan containers (test_container_myalpine_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
    Pulling db (mysql:)...
    latest: Pulling from library/mysql
    b380bbd43752: Pull complete
    f23cbf2ecc5d: Pull complete
    30cfc6c29c0a: Pull complete
    b38609286cbe: Pull complete
    8211d9e66cd6: Pull complete
    2313f9eeca4a: Pull complete
    7eb487d00da0: Pull complete
    4d7421c8152e: Pull complete
    77f3d8811a28: Pull complete
    cce755338cba: Pull complete
    69b753046b9f: Pull complete
    b2e64b0ab53c: Pull complete
    Digest: sha256:6d7d4524463fe6e2b893ffc2b89543c81dec7ef82fb2020a1b27606666464d87
    Status: Downloaded newer image for mysql:latest
    Building web
    free(): invalid pointer
    SIGABRT: abort
    PC=0x7f843c64ef47 m=0 sigcode=18446744073709551610
    signal arrived during cgo execution
    
    goroutine 1 [syscall, locked to thread]:
    runtime.cgocall(0x4afd50, 0xc420055cc0, 0xc420055ce8)
            /usr/lib/go-1.8/src/runtime/cgocall.go:131 +0xe2 fp=0xc420055c90 sp=0xc420055c50
    github.com/docker/docker-credential-helpers/secretservice._Cfunc_free(0x1df69a0)
            github.com/docker/docker-credential-helpers/secretservice/_obj/_cgo_gotypes.go:111 +0x41 fp=0xc420055cc0 sp=0xc420055c90
    github.com/docker/docker-credential-helpers/secretservice.Secretservice.List.func5(0x1df69a0)
            /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go:96 +0x60 fp=0xc420055cf8 sp=0xc420055cc0
    github.com/docker/docker-credential-helpers/secretservice.Secretservice.List(0x0, 0x756060, 0xc420014360)
            /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go:97 +0x217 fp=0xc420055da0 sp=0xc420055cf8
    github.com/docker/docker-credential-helpers/secretservice.(*Secretservice).List(0x77e548, 0xc420055e88, 0x410022, 0xc4200142c0)
            <autogenerated>:4 +0x46 fp=0xc420055de0 sp=0xc420055da0
    github.com/docker/docker-credential-helpers/credentials.List(0x756ba0, 0x77e548, 0x7560e0, 0xc42000e018, 0x0, 0x10)
            /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:145 +0x3e fp=0xc420055e68 sp=0xc420055de0
    github.com/docker/docker-credential-helpers/credentials.HandleCommand(0x756ba0, 0x77e548, 0x7fffffa0fe77, 0x4, 0x7560a0, 0xc42000e010, 0x7560e0, 0xc42000e018, 0x40e398, 0x4d35c0)
            /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:60 +0x16d fp=0xc420055ed8 sp=0xc420055e68
    github.com/docker/docker-credential-helpers/credentials.Serve(0x756ba0, 0x77e548)
            /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:41 +0x1cb fp=0xc420055f58 sp=0xc420055ed8
    main.main()
            /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/secretservice/cmd/main_linux.go:9 +0x4f fp=0xc420055f88 sp=0xc420055f58
    runtime.main()
            /usr/lib/go-1.8/src/runtime/proc.go:185 +0x20a fp=0xc420055fe0 sp=0xc420055f88
    runtime.goexit()
            /usr/lib/go-1.8/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc420055fe8 sp=0xc420055fe0
    
    goroutine 17 [syscall, locked to thread]:
    runtime.goexit()
            /usr/lib/go-1.8/src/runtime/asm_amd64.s:2197 +0x1
    
    rax    0x0
    rbx    0x7fffffa0f8c0
    rcx    0x8
    rdx    0x0
    rdi    0x2
    rsi    0x7fffffa0f650
    rbp    0x7fffffa0f9c0
    rsp    0x7fffffa0f650
    r8     0x0
    r9     0x7fffffa0f650
    r10    0x8
    r11    0x8
    r12    0x7fffffa0f8c0
    r13    0x1000
    r14    0x0
    r15    0x30
    rip    0x7f843c64ef47
    rflags 0x246
    cs     0x33
    fs     0x53
    gs     0x2b
    Sending build context to Docker daemon  3.072kB
    Step 1/3 : FROM alpine
     ---> 14119a10abf4
    Step 2/3 : RUN apk add bash procps curl
     ---> Using cache
     ---> 7db8f8645046
    Step 3/3 : CMD sh -c "(while :; do date; sleep 1; done) >&2"
     ---> Using cache
     ---> 22605e0d9f68
    Successfully built 22605e0d9f68
    Successfully tagged test_container_web:latest
    WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
    Creating test_container_db_1 ... done
    Creating test_container_web_1 ... error
    
    ERROR: for test_container_web_1  Cannot start service web: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"bundle\": executable file not found in $PATH": unknown
    
    ERROR: for web  Cannot start service web: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"bundle\": executable file not found in $PATH": unknown
    ERROR: Encountered errors while bringing up the project.
    

    좋은 웹페이지 즐겨찾기