C4W2-lab_FastApi-Docker

I am experiencing 2 problems in the ungraded lab.

I use Docker Desktop in Administrator mode on Windows.

  1. When building the dockerfile the build fails at the requirement.txt stage.
    Here is the error that I am getting:
    => ERROR [3/4] RUN pip install -r requirements.txt && rm requirements.txt 9.2s

[3/4] RUN pip install -r requirements.txt && rm requirements.txt:
1.310 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7
f25d1fab2d0>: Failed to establish a new connection: [Errno 16] Device or resource busy’)‘: /simple/fastapi/
1.864 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7
f25d1fab750>: Failed to establish a new connection: [Errno 16] Device or resource busy’)‘: /simple/fastapi/
2.949 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7
f25d0d77450>: Failed to establish a new connection: [Errno 16] Device or resource busy’)‘: /simple/fastapi/
5.005 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7
f25d0d77d50>: Failed to establish a new connection: [Errno 16] Device or resource busy’)‘: /simple/fastapi/
9.057 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7
f25d0d90290>: Failed to establish a new connection: [Errno 16] Device or resource busy’)': /simple/fastapi/
9.108 ERROR: Could not find a version that satisfies the requirement fastapi (from versions: none)
9.108 ERROR: No matching distribution found for fastapi


Dockerfile:5

4 |
5 | >>> RUN pip install -r requirements.txt &&
6 | >>> rm requirements.txt

7
ERROR: failed to solve: process “/bin/sh -c pip install -r requirements.txt && \trm requirements.txt” did not complete successfully: exit code: 1
  1. After installing the libraries from requirements file in an environment and removing the requirements from the dockerfile I was able to build it. However when I try to run this is the error that I get:

docker: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:80 → 0.0.0.0:0: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its acces
s permissions.

This lab is deprecated in favor of newer version of the specialization. So, please don’t expect the staff to fix anything.

Try another port instead of 80 (after checking that the port is indeed free) and see if it fixes the issue.