<클라우드 컴퓨팅>Docker machine 설치에러 - Code E_ACCESSDENIED (0x80070005)

노설·2022년 4월 13일
1

클라우드 컴퓨팅

목록 보기
6/9

Docker Machine을 사용하기에 앞서, (Window11 => Ubuntu Docker Machine 수행)
Window 11을 사용중이었다.
2021년 말쯤 부터 Docker docs 공식페이지에서 Docker Machine에 대한 내용이 제공되지않는다.
Docker Toolbox는 2020년 말부터 제공되지 않는 듯 하다(구글링을 해보니,,)
Window11에서 안되지만 Linux에서 된다는 것을 알게 되었고, Docker Machine을 사용하기 위해 나는 리눅스 배포판인 Ubuntu 18.04.6 LTS 서버를 사용했다.
(2022-04-13 작성 일자 기준으로 Window 10은 사용가능하다고 한다..... 보다 원활하게 사용하고자 Window를 업그레이드 했건만,,,)

관련 Docker docs 페이지 클릭

1. Window11에서 docker-machine 명령어로 생성하다 만난 에러 (우분투에서 실행시 해당에러를 만날 수 없었음.)

PS C:\Users\username\.docker\machine\machines\default> docker-machine create --driver virtualbox manager1
Running pre-create checks...
Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"
You can further specify your shell with either 'cmd' or 'powershell' with the --shell flag.

🌞보다시피 This computer doesn't have VT-X/AMD-v enabled 상태라고 하는데 나는 이미 로컬에서
해당 명령어가 나올경우 해결방법은 하기와 같다.

  1. BIOS 설정 - VT-X/AMD-v
  2. Windows 기능 켜기/끄기 - HyperV 끄기

나는 Docker를 원활하게 수행한 상태였다. 그래서 BIOS설정을 이미 한 상태, 거기에다 Hyper-V는 off 되어있었다.
Docker Machine이 Window11에서 원활하게 지원되지 않아서 그런거라 판단을 했기 때문에 Unix에서 수행하기로 했다.

2. Ubuntu에서 docker-machine 명령어로 도커머신을 만들다 만난 에러

user@user:/$ docker-machine create  manager1
Running pre-create checks...
Creating machine...
(manager1) Copying /home/user/.docker/machine/cache/boot2docker.iso to /home/user/.docker/machine/machines/manager1/boot2docker.iso...
(manager1) Creating VirtualBox VM...
(manager1) Creating SSH key...
(manager1) Starting the VM...
(manager1) Check network to re-create if needed...
(manager1) Found a new host-only adapter: "vboxnet0"
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: /usr/bin/VBoxManage hostonlyif ipconfig vboxnet0 --ip "아이피주소" --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp

🌞에러가 발생했지만, 생성된 도커머신을 확인해보았다.

user@user:/$ docker-machine ls


역시나! Driver를 찾지못한다거나 Error상태와 더불어 Docker 버전도 나타나지 않아 작동이 되지않았다.

🌞 원인 : /usr/bin/VBoxManage 문제

명령어를 실행하고 나오는 에러로그를 유심히 살펴보았다.
/usr/bin/VBoxManage 파일 안에 ip 주소가 적혀져있고, 거기서 도커 머신을 동작시키는데 필요한 네트워크 세팅이 문제가 있는 듯 해보인다.
추가로 이로인해 Code E_ACCESSDENIED (0x80070005)라는 에러를 띄워주며 Access denied이 되었다.
구글링을 몇번했는데 Code E_ACCESSDENIED (0x80070005)는 다양한 경우에 나오는것 같았다. 이를테면 vagrant를 사용하다가 나타난 케이스도 보았으나 나처럼 도커머신을 처음 설치하고 작동시킬 경우 에러를 만난 케이스는 보지못했다.

🌞 /usr/bin/VBoxManage 파일에 문제가 있다니 한 번 가보자.

cat /usr/bin/VBoxManage
# VirtualBox installation directory
INSTALL_DIR="/usr/lib/virtualbox"

# Note: This script must not fail if the module was not successfully installed
#       because the user might not want to run a VM but only change VM params!

if [ ! -c /dev/vboxdrv ]; then
    cat << EOF
WARNING: The character device /dev/vboxdrv does not exist.
	 Please install the virtualbox-dkms package and the appropriate
	 headers, most likely linux-headers-$(uname -r | cut -d- -f3).

	 You will not be able to start VMs until this problem is fixed.
EOF
fi

SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
if [ -z "$SERVER_PID" ]; then
    # Server not running yet/anymore, cleanup socket path.
    # See IPC_GetDefaultSocketPath()!
    if [ -n "$LOGNAME" ]; then
        rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
    else
        rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
    fi
fi

🌞 읽다보면 You will not be able to start VMs until this problem is fixed.라고 Hint를 주는 부분이 보인다. 친절하게도 해결방법을 알려준다.

Please install the virtualbox-dkms package and the appropriate
	 headers, most likely linux-headers-$(uname -r | cut -d- -f3).

🌞 설명에 맞추어 실행해보았다.
하기 명령어는 커널 소스를 설치한고 vbox용 dkms/kernel 모듈을 추가로 설치해주었다.

sudo apt-get install linux-headers-`uname -r`
sudo apt-get install virtualbox-dkms

#만일 작동하지 않는다면?
sudo apt-get update
sudo apt-get remove virtualbox virtualbox-qt virtualbox-dkms
sudo apt-get install linux-headers-`uname -r` virtualbox-qt virtualbox-dkms --reinstall

🌞 위의 코드대로 하였지만 작동이 되지않아서 서버를 리부트했고 docker-machine을 만들었더니 💚성 공💚

user@user:~$ sudo docker-machine create  manager1
Running pre-create checks...
Creating machine...
(manager1) Copying /home/user/.docker/machine/cache/boot2docker.iso to /home/user/.docker/machine/machines/manager1/boot2docker.iso...
(manager1) Creating VirtualBox VM...
(manager1) Creating SSH key...
(manager1) Starting the VM...
(manager1) Check network to re-create if needed...
(manager1) Found a new host-only adapter: "vboxnet9"
(manager1) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env manager1
user@user:~$ sudo docker-machine ls

🌞깔끔하게 STATE 상태와 ,URL, DOCKER 버전까지 나와주었다!

🌞누군가에게 도움이 되길 바라며 블로그에 올려본다!

profile
IT업계에서 노설 이라는 이름이 보이면 그건 무조건 나.

0개의 댓글