I'm writing below script which will build docker image and then push it to ECR. Here, in this snippet I'm posting the error while building the image. This is in Window OS local machine and python version is 3.8.0
I have below folderstructure:
/home:
-->ECR
-->buildImage.py
Dockerfile
The script /home/ECR/buildImage.py looks like this:
import docker
docker_api = docker.APIClient()
dockerfile_path = os.path.dirname(os.getcwd())
print("Docker file location: " + dockerfile_path)
if os.path.isfile(dockerfile_path + "\\Dockerfile"):
print("File exists")
else:
print("File does not exist...")
docker_api.build(path=dockerfile_path, tag=local_tag, rm=True, dockerfile=".\\Dockerfile")
This above throws me error:
pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.')
and with this one,
docker_api.build(path='dockerfile_path', tag=local_tag, rm=True, dockerfile=".\\Dockerfile")
this throws me
TypeError: You must specify a directory to build in path
How can I fix this? Is it necessary that on your local machine which in my case in Window Docker should be available? Docker is not installed but docker python package version 4.1.0 is installed.
print(docker.__version__)
>> 4.1.0