Development Tip

Docker 명령 실패 (Windows)

yourdevel 2020. 11. 20. 09:44
반응형

Docker 명령 실패 (Windows)


Windows 시스템에서 Docker를 사용하려고하는데 가능한 모든 문제가 발생합니다. 내 최신 항목은 다음과 같습니다. 내 컴퓨터가 실행 중이지만 docker 명령을 사용하여 상호 작용할 수없는 것 같습니다. 다음과 같은 매우 표준 명령을 실행하면

docker ps

다음과 같은 오류 메시지가 나타납니다.

An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v
1.23/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.

그래서 분명히 일부 경로는 모두 엉망입니다. 누구든지 이것이 어떤 경로이며 이것을 고치는 방법을 알고 있습니까?


실행 docker ps및 수신시 :

연결하는 동안 오류가 발생했습니다 : Get http : //%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json : open //./pipe/docker_engine : 시스템이 지정된 파일을 찾을 수 없습니다.

다음 환경 속성을 설정해야합니다.

 set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
 set DOCKER_HOST=tcp://192.168.99.100:2376
 set DOCKER_MACHINE_NAME=default
 set DOCKER_TLS_VERIFY=1

이것은이 가정되는 %USERPROFILE%\.docker\machine\machines\default기본 경로 곳 cert.pem, key.pem, ca-key.pem, 및 ca.pem고정 표시기 파일이 있습니다; 가상 머신 이름 (으로 생성됨 docker-machine create)은 default이고 Virtual Box DHCP 서버의 하한 (VirtualBox-> File-> Preferences-> Network-> Host-only Networks-> VirtualBox Host-Only Ethernet Adapter의 마우스 오버 아래에 있음)은 192.168. 99.100이고 VirtualBox에서 다른 VM이 실행되고 있지 않습니다.


docker-machine을 사용할 때이 문제가 발생하고 docker-machine env재부팅 후 명령을 실행하지 않았습니다 . cmd.exe에서이 작업을 수행하는 방법을 잘 모르겠지만 powershell을 사용하는 경우 다음 명령을 실행하십시오.

docker-machine env --shell=powershell | Invoke-Expression

Win 7에서도 동일한 문제가 발생합니다. 솔루션 :

Docker 빠른 시작 창의 $ 프롬프트에서 아래 줄을 실행합니다.

your_user @ your_machine MINGW64 ~

$ eval $ ( "C : \ Program Files \ Docker Toolbox \ docker-machine.exe"env 기본값)

그런 다음 "docker run hello-world"를 실행할 수 있습니다.


Hyper-V가 실행되고 있는지 확인합니다.

  • 상승 된 명령 프롬프트 열기
  • 유형 bcdedit /set hypervisorlaunchtype auto
  • 재부팅
  • "Docker for Windows"실행

  1. 관리자 권한으로 cmd를 엽니 다.
  2. 다음 명령 실행

    docker-machine env --shell cmd 기본값

  3. 다음과 같은 출력을 받게됩니다.

    SET DOCKER_TLS_VERIFY = 1

    DOCKER_HOST = tcp : //192.168.99.102 : 2376 설정

    SET DOCKER_CERT_PATH = C : \ Users \ DBashyal.docker \ machine \ machines \ default

    SET DOCKER_MACHINE_NAME = 기본값

    REM 다음 명령을 실행하여 셸을 구성합니다.

    REM @FOR / f "tokens = *"% i IN ( 'docker-machine env --shell cmd default') DO @ % i

  4. 강조 표시된 줄을 복사하고 cmd에서 실행하십시오.

    @FOR / f "tokens = *"% i IN ( 'docker-machine env --shell cmd default') DO @ % i

  5. 다음 명령 실행

    도커 PS


아래 명령을 사용하여 새 컴퓨터를 만들었습니다.

docker-machine create --driver=virtualbox vbox-test

그런 다음 명령을 실행했습니다.

docker-machine env --shell=powershell | Invoke-Expression

됐어요 ...


Windows에서도 같은 문제를 다루어야했습니다.

그것을 해결하려면 :

  1. 도커 머신 만들기 (없는 경우에만)

    docker-machine create  default
    
  2. 도커 머신 (서버)에 연결하기 위해 도커 클라이언트에 필요한 ENV 변수를 가져옵니다. [이 작업은 매번 수행하거나 ENV 변수에 설정해야합니다.]

    docker-machine.exe env default
    

    당신이 중 하나를 수동으로 설치 또는 중 하나를 실행할 수에 따라 다음과 같은 당신의 shell environment( cmd, bash, power-shell)

    docker-machine env --shell=cmd # you need to run it manually
    docker-machine env --shell=bash > env-var-commands-tmp && . env-var-commands-tmp && rm env-var-commands-tmp
    docker-machine env --shell=powershell | Invoke-Expression
    

나는 위의 모든 답변을 보았지만 아무도 작동하지 않았습니다. 그런 다음 명령이 bash와 같은 Linux 명령 줄에서 실행되어야한다는 것을 알았습니다. 그래서 시도하십시오 :

Windows cmd가 아닌 docker 도구 상자와 함께 제공되는 Docker bash 터미널 VM에 명령을 입력하십시오.

Docker가 시작되었는지 이미 확인한 경우


다른 답변에서 지적했듯이 몇 가지 환경 변수를 설정해야합니다.

가장 쉬운 방법은 다음과 같습니다.

 @FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd') DO @%i

그러면 docker-machine env --shell cmd해당 환경 변수 가 실행 되고 추가 됩니다 .

이러한 변수를 영구적으로 유지하려면 창에서 정의하십시오 ( tutorial ).


트레이에서 Docker 아이콘을 마우스 오른쪽 버튼으로 클릭하고 "Windows 컨테이너로 전환 ..."을 선택합니다. 컨테이너 기능을 활성화하라는 메시지가 표시 될 수 있습니다. 그렇게하고 다시 부팅하십시오.


Windows 버전 17.11.0-ce-rc4-win39 (14244) 채널 : edge e557194 용 Docker CE를 Windows 10에 설치했을 때 비슷한 문제가 발생했습니다.

Command / cmd 창에서 docker ps, docker version, docker info 명령을 실행하려고 할 때“연결 중 오류 : Get http : //%2F%2F.%2Fpipe%2Fdocker_engine/v1.34/ 버전 ”매번.

이 문제를 해결하려면

  1. OS를 다시 시작해야하는“Windows 기능 켜기 또는 끄기”에서“Hyper-V”를 해제 (선택 안 함)했습니다.
  2. 그리고 처음 다시 시작한 후 "Hyper-V"를 On (Checked)으로 설정했는데 다시 OS를 다시 시작해야했습니다.

두 번째 다시 시작한 후 위의 docker 명령이 작동하기 시작하여 적절한 출력을 제공했습니다.

그래서, Hyper-V를 돌려 떨어져 다음과 저를 위해이 문제를 해결.


문제 에서 해결책을 얻었습니다 . 그것은 단지처럼 소재한의 대답은 말했다 SwitchDaemon직접 수정 할 수있다. 데몬을 이전 데몬으로 전환하려면이 명령을 두 번 실행해야한다고 생각합니다.

cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
# then check the docker OS/Arch
docker version
# You may see the different OS/Arch 
./DockerCli.exe -SwitchDaemon
# then you got your images and containers back 

이 명령은 defualt 데몬에서 다른 데몬으로 데몬을 전환하는 것입니다 (설정 한 내용에 따라 다름). 다른 데몬으로 전환하면 이전 데몬의 이미지와 컨테이너가 사라지지만 손실되지는 않습니다.


Windows에서 기본 호스트를 시작하려면 아래 세 가지 방법 중 하나를 사용할 수 있습니다.

  1. 시작하거나 다시 시작하면 Docker에 의해 이미 기본 머신이 생성되었습니다.

    docker-machine start default
    docker-machine restart default
    

    이제 확인 docker-machine env

  2. 다음 환경 속성을 설정해야합니다.

    set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
    set DOCKER_HOST=tcp://192.168.99.100:2376
    set DOCKER_MACHINE_NAME=default
    set DOCKER_TLS_VERIFY=1
    
  3. 다음 명령을 사용하여 새 컴퓨터를 만들려면 :

Windows 10 / HyperV :

docker-machine create --driver hyperv default
docker-machine create -d hyperv default

Mac, Linux, Windows 7 및 8 :

docker-machine create --driver virtualbox default
docker-machine create -d virtualbox default

Windows 2016 컴퓨터에서이 문제가 발생했습니다. Docker 서비스가 시작되지 않았기 때문에 발생했습니다. 제 경우에는 다음 오류로 인해 도커 서비스가 실패했습니다.

치명적 : 데몬 시작 오류 : pid 파일이 발견되었습니다. docker가 실행되고 있지 않은지 확인하거나 C : \ ProgramData \ docker.pid를 삭제하십시오.

C : \ ProgramData \ docker.pid 파일을 삭제하면 트릭이 발생했습니다.


아래 해결되었습니다. 다른 포럼의 답변을 복사했습니다.

업데이트 후이 문제가 발생했습니다. VB를 다시 설치 한 후 속성 네트워크 연결에서 "VirtualBox NDIS6 Bridged Networking Driver"를 켰습니다.

내 경우에는 속성이 기본값으로 전환되었습니다. `


Windows 10 Professional 나에게는 Docker 서비스가 실행 중이었지만 Docker는 여전히 '시작'해야했습니다. 즉, Docker 트레이 아이콘에서 '로그인 할 때 Docker 시작'설정을 선택 취소했습니다.

이것을 찾기 전에 Docker 프로그램 폴더로 이동하여 'Docker for Windows'를 클릭했습니다. 잠시 후 'Docker가 실행 중입니다'라는 메시지가 표시되었습니다.


나를 위해이 오류는 daemon.json파일을 제거한 후 해결 되었습니다."%programdata%\docker\config"

내 콘텐츠 daemon.json는 다음과 같습니다.

{
  "hosts": ["tcp://0.0.0.0:2375"]
}

I created this manually as part of some testing. But after I restarted the server, I started to get the error in this question.


The error is really troubling. I hope Docker Developers do something about. It took a lot of try and error to get around. Thanks to Stackoverflow and other blogs. In my case, I am using Windows 10 Pro. I settled with DockerToolbox.exe after several failed attempts with Docker for Windows Installer.exe. Then I encountered An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v . The followed these steps and the problem got solved. First, I went to Control Panel -> Turn Windows Features On or Off and unchecked Hyper-V
여기에 이미지 설명 입력 Next, Open PowerShell as Admin:

docker-machine env --shell=powershell | Invoke-Expression
type bcdedit /set hypervisorlaunchtype auto

Restarted my System. Then I launched "Docker Quickstart Terminal", then I entered this on the shell window.

run "Docker for Windows"
docker run hello-world

I it went well. Then I open Command Prompt

docker run hello-world

It gave the error: Then I entered

set DOCKER_CERT_PATH=%USERPROFILE%\.docker\machine\machines\default
set DOCKER_HOST=tcp://192.168.99.100:2376
set DOCKER_MACHINE_NAME=default
set DOCKER_TLS_VERIFY=1

Most of the suggestions above too are helpful.


I saw this error message after a weekend. My setup was fine before that. My config and connections looked correct. $docker-machine restart default fixed it for me on Windows 7


I was getting this error, while running the command docker-compose up. The problem for me was, the docker service was not running. So I had to run services.msc and start the docker service.

여기에 이미지 설명 입력


I solved this error by run the {DOCKER_TOOLBOX_INSTALL_PATH}start.sh in bash.


In my case, all above solutions did not resolve. Instead zilurrane response helped.

    cd "C:\Program Files\Docker\Docker"
    ./DockerCli.exe -SwitchDaemon

  1. Switch to Windows Containers
  2. docker info
  3. docker ps
  4. Switch back to Linux containers
  5. docker info
  6. Viola!

The windows switch likely runs the missing configurations that Linux also needs.


비슷한 문제가 발생했습니다. 나를 위해 상태 표시 줄에서 도커에 로그인하지 않았습니다. 내가 한 일은 상태 표시 줄에서 도커에 로그인하는 것입니다. 로그인 한 후 모든 명령을 제대로 실행할 수있었습니다. Docker ID와 암호를 사용하여 로그인하면 문제가 해결 될 수 있습니다.


Windows 10에서 동일한 문제가 발생했습니다. 아래에서 해결 방법을 찾아보십시오.

Docker를 설치 한 후 PC를 다시 시작하고 Docker 애플리케이션을 실행 한 다음 (Hyper-V를 활성화해야 할 수 있음) 명령 줄을 열고 다음을 입력합니다. docker run hello-world

모든 것이 잘 작동합니다. :)

참고 URL : https://stackoverflow.com/questions/37527888/docker-commands-fails-in-windows

반응형