alexisrolland/docker-openssl

Cannot build Dockerfile on Windows OS

Devnsyde opened this issue · 4 comments

In regards to your comment about being able to run this on Windows or Linux operating system I keep trying to build the Dockerfile and getting the following error:

PS D:\docker-cert-gen> docker build -t openssl:latest .
Sending build context to Docker daemon  2.048kB
Step 1/5 : FROM alpine:3.8
3.8: Pulling from library/alpine
no matching manifest for windows/amd64 10.0.17763 in the manifest list entries

I am assuming this is because I have Windows containers, how do I get this to work with Windows containers? I can't dual install Linux and Windows containers as it's an experimental feature still.

Hello,
It seems your issue happens when your process downloads the Alpine Docker image. It also seems you have modified the Dockerfile compared to this repository because you are using alpine:3.8 while this repository is using alpine:latest.

I have modified the Dockerfile in this repository to use alpine:3.8 so that I can try to reproduce your issue. I am also running this repository on Windows and was not able to reproduce your issue.

Dockerfile

FROM alpine:3.8

# Install OpenSSL
RUN apk update && \
  apk add --no-cache openssl && \
  rm -rf "/var/cache/apk/*"

# Create and set mount volume
WORKDIR /openssl-certs
VOLUME  /openssl-certs

ENTRYPOINT ["openssl"]

Test on Windows

$ docker build -t openssl:latest .
Sending build context to Docker daemon  117.2kB
Step 1/5 : FROM alpine:3.8
3.8: Pulling from library/alpine
486039affc0a: Pull complete
Digest: sha256:2bb501e6173d9d006e56de5bce2720eb06396803300fe1687b58a7ff32bf4c14
Status: Downloaded newer image for alpine:3.8
 ---> c8bccc0af957
Step 2/5 : RUN apk update &&   apk add --no-cache openssl &&   rm -rf "/var/cache/apk/*"
 ---> Running in babe9e202dfc
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
v3.8.5-5-g86f2db7e3b [http://dl-cdn.alpinelinux.org/alpine/v3.8/main]
v3.8.4-286-gda0d4ca4ff [http://dl-cdn.alpinelinux.org/alpine/v3.8/community]
OK: 9563 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/3) Installing libcrypto1.0 (1.0.2u-r0)
(2/3) Installing libssl1.0 (1.0.2u-r0)
(3/3) Installing openssl (1.0.2u-r0)
Executing busybox-1.28.4-r3.trigger
OK: 8 MiB in 16 packages
Removing intermediate container babe9e202dfc
 ---> d1e3a224ff89
Step 3/5 : WORKDIR /openssl-certs
 ---> Running in e604887d1c0c
Removing intermediate container e604887d1c0c
 ---> 6033b30be510
Step 4/5 : VOLUME  /openssl-certs
 ---> Running in 5b176caceade
Removing intermediate container 5b176caceade
 ---> 892dbc5a4eeb
Step 5/5 : ENTRYPOINT ["openssl"]
 ---> Running in 0d383fcd618b
Removing intermediate container 0d383fcd618b
 ---> 87f61389b3a4
Successfully built 87f61389b3a4
Successfully tagged openssl:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.

I am not if / what other changes you may have done but for testing purpose I would suggest you to:

  • Clone this repository and do not modify anything
  • Run it as described in the README

Let me know if it works

It seems you are correct, as described here:
https://stackoverflow.com/questions/48066994/docker-no-matching-manifest-for-windows-amd64-in-the-manifest-list-entries

Your Docker configuration is setup to run Windows containers while this is a Linux container. You should find a solution in the link above. Please let me know if it works and I'll update the README.

Yea I saw that I could enable the dual OS thing via docker I just didn't want to do that as it is experimental. So I was hoping there really was a way to run this via windows and I was just doing something wrong.

I was also running the 3.8 version cause I was trying to follow the guide that this repo was built from.

Do you know if I build another server and run linux on it if I can then use this image to create certs for a windows container on a different server?

I am not sure I understood you completely but the issue has nothing to do with your host OS. It has to do with your Docker configuration in which you indicate which type of Docker containers you want to build: Linux containers or Windows containers .

If your Dockerfile is using an Alpine base image which is a Linux distribution, you need to change your Docker configuration to Linux containers:

image