spurin / diveintoansible-lab

Dive Into Ansible Lab
850 stars 531 forks source link

Facing with exceptions while running docker-compose up in windows command prompt #26

Closed Sneha-Reddy975 closed 3 years ago

Sneha-Reddy975 commented 3 years ago

C:\Users\miriyala\diveintoansible-lab>docker-compose up 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 439, in send File "urllib3\connectionpool.py", line 670, in urlopen File "urllib3\connectionpool.py", line 392, in _make_request File "http\client.py", line 1255, in request File "http\client.py", line 1301, in _send_request File "http\client.py", line 1250, in endheaders File "http\client.py", line 1010, in _send_output File "http\client.py", line 950, in send File "docker\transport\npipeconn.py", line 32, in connect File "docker\transport\npipesocket.py", line 23, in wrapped File "docker\transport\npipesocket.py", line 72, in connect File "docker\transport\npipesocket.py", line 52, in connect pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "docker-compose", line 3, in File "compose\cli\main.py", line 81, in main File "compose\cli\main.py", line 199, in perform_command File "compose\cli\command.py", line 60, in project_from_options File "compose\cli\command.py", line 152, in get_project File "compose\cli\docker_client.py", line 41, 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 221, in _retrieve_server_version docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.') [25332] Failed to execute script docker-compose

miriyala@SCEOV4UMNB MINGW64 ~/diveintoansible-lab (master) $ cat .env

sshd ports

UBUNTUC_PORT_SSHD=2221 UBUNTU1_PORT_SSHD=2222 UBUNTU2_PORT_SSHD=2223 UBUNTU3_PORT_SSHD=2224 CENTOS1_PORT_SSHD=2225 CENTOS2_PORT_SSHD=2226 CENTOS3_PORT_SSHD=2227

ttyd (web terminal) ports

UBUNTUC_PORT_TTYD=7681 UBUNTU1_PORT_TTYD=7682 UBUNTU2_PORT_TTYD=7683 UBUNTU3_PORT_TTYD=7684 CENTOS1_PORT_TTYD=7685 CENTOS2_PORT_TTYD=7686 CENTOS3_PORT_TTYD=7687

Shared config volume

CONFIG=/host_mnt/c/users/miriyala/diveintoansible-lab/config

Shared home directories

ANSIBLE_HOME=/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home

spurin commented 3 years ago

Hi @Sneha-Reddy975

I've had this before myself and I'd just like to check, is Docker running?

Sneha-Reddy975 commented 3 years ago

Hi @spurin

It wasn't running when i executed this command. Now i started it , and can see the exceptions are cleared. I guess that was the issue. Thanks

spurin commented 3 years ago

Awesome,

Glad it's resolved @Sneha-Reddy975

This issue frustrates me ... it's so confusing and the Docker output poses no clear indication of the problem. I may try and see if I can raise this as an issue with docker(-compose) if it hasn't been raised already :-)

Sneha-Reddy975 commented 3 years ago

Yes you are right. Can you please tell me what's the issue here.

C:\Users\miriyala\diveintoansible-lab>docker-compose up Docker Compose is now in the Docker CLI, try docker compose up

Starting ubuntu2 ... Starting centos3 ... Starting centos1 ... Starting centos2 ... Starting ubuntu1 ... Starting centos1 ... error Starting ubuntu3 ... Starting centos3 ... error ERROR: for docker Cannot start service docker: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/shared': mkdir /host_mnt/c/users: operation not permitted Creating ubuntu-c ...

ERROR: for centos1 Cannot start service centos1: error while creating mount source path '/host_mnt/c/users/miriyala/divStarting ubuntu1 ... error

ERROR: for centos3 Cannot start service centos3: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/centos3/root': mkdir /host_mnt/c/users: operation not permitted

Starting ubuntu2 ... error eintoansible-lab/ansible_home/ubuntu1/ansible': mkdir /host_mnt/c/users: operation not permitted

ERROR: for ubuntu3 Cannot start service ubuntu3: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/config': mkdir /host_mnt/c/users: operation not permitted

ERROR: for centos2 Cannot start service centos2: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/shared': mkdir /host_mnt/c/users: operation not permitted

ERROR: for ubuntu2 Cannot start service ubuntu2: error while creating mount source path '/host_mnt/c/users/miriyala/divCreating ubuntu-c ... error

ERROR: for ubuntu-c Cannot start service ubuntu-c: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/config': mkdir /host_mnt/c/users: operation not permitted

ERROR: for docker Cannot start service docker: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/shared': mkdir /host_mnt/c/users: operation not permitted

ERROR: for centos1 Cannot start service centos1: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/centos1/root': mkdir /host_mnt/c/users: operation not permitted

ERROR: for centos3 Cannot start service centos3: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/centos3/root': mkdir /host_mnt/c/users: operation not permitted

ERROR: for ubuntu1 Cannot start service ubuntu1: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/ubuntu1/ansible': mkdir /host_mnt/c/users: operation not permitted

ERROR: for ubuntu3 Cannot start service ubuntu3: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/config': mkdir /host_mnt/c/users: operation not permitted

ERROR: for centos2 Cannot start service centos2: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/shared': mkdir /host_mnt/c/users: operation not permitted

ERROR: for ubuntu2 Cannot start service ubuntu2: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/ansible_home/ubuntu2/ansible': mkdir /host_mnt/c/users: operation not permitted

ERROR: for ubuntu-c Cannot start service ubuntu-c: error while creating mount source path '/host_mnt/c/users/miriyala/diveintoansible-lab/config': mkdir /host_mnt/c/users: operation not permitted ERROR: Encountered errors while bringing up the project.

spurin commented 3 years ago

Hi @Sneha-Reddy975

Have re-opened the issue so we can track this. Could you please tell me what your version of Windows is (Start / Run / winver)

Also, did you install Docker or was Docker already installed. If you had Docker already installed, what version is it?

Thanks!

Sneha-Reddy975 commented 3 years ago

Hi @spurin

I am using Windows 10 version and i have installed docker 20.10.5 following your instructions in Dive Into Ansible - From Beginner to Expert in Ansible learning module

Sneha-Reddy975 commented 3 years ago

And it's Start

Sneha-Reddy975 commented 3 years ago

Hi @spurin Any update on this error.

spurin commented 3 years ago

Hi @Sneha-Reddy975

My apologies, I lost track on this one where I thought we'd resolved it.

When you installed Docker, did you do it via Docker Desktop or some other way?

Also, what is your version of Windows with patch please?

Sneha-Reddy975 commented 3 years ago

Hi @spurin I installed Docker via Docker Desktop I am using the 64-bit version of Windows

spurin commented 3 years ago

There's something not right here and I think it's related to your version of Windows. I need some more specifics to troubleshoot this further. Can you please click Start, choose Run and enter Winver. If you can provide a screenshot of the output that would be great, otherwise share with me the Version XXXX (OS Build XXXXX.XXX) Information.

Thanks!

Sneha-Reddy975 commented 3 years ago

image

spurin commented 3 years ago

Thanks @Sneha-Reddy975

This helps a lot. I'm guessing this is a company system?

Unfortunately and annoyingly, this version of Windows is quite old, technically it's unsupported now and the version of WSL (WSL1) that Docker uses can cause some problems.

If it's possible to do a windows update that would fix it but, that itself has its own risks (especially if it's a corporate system).

I have another version of the lab environment that we can run in a virtual machine (it's essentially a vm with Docker installed). I've just recently created this and I think it's perfect for the situation you're in.

Are you able to install and run Virtualbox on your machine?

If so, I could guide you through this setup.

Thanks

James

Sneha-Reddy975 commented 3 years ago

Yes I am using a company system. We can try this virtual machine.

Thanks @spurin

spurin commented 3 years ago

Hi @Sneha-Reddy975

Am just uploading the image for you, it will be available from here - https://www.dropbox.com/s/8tmyrt69cfh76yj/Dive%20Into%20Ansible.zip?dl=0

Could you download, unzip and then double click either the .vbox or .vdi file

Once that's done, could you click settings, goto network and choose Port Forwarding, then share with me what you see as a screenshot. I'm hoping that the port forwarding settings are retained upon import, otherwise I'll help you add the appropriate values.

Thanks

Sneha-Reddy975 commented 3 years ago

Hi @spurin The downloading part is complete but i don't see the Port Forwarding option in my network settings.

image

spurin commented 3 years ago

Hi @Sneha-Reddy975

Sorry, I'm referring to the settings of the virtual machine, within virtualbox you should be able to choose settings, network, port forwarding.

It may be slightly different on Windows but this is roughly where to look.

Thanks

Sneha-Reddy975 commented 3 years ago

Hi @spurin Sorry, got stuck up in other works. Okay i got your point . image

Sneha-Reddy975 commented 3 years ago

Thanks @spurin

The issue is resolved. The lab environment in virtual machine is working fine.