Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building custom image from caddy:2.6.2 failed #273

Closed
nick-ge opened this issue Dec 5, 2022 · 2 comments · Fixed by #275 or #274
Closed

Building custom image from caddy:2.6.2 failed #273

nick-ge opened this issue Dec 5, 2022 · 2 comments · Fixed by #275 or #274
Labels
bug Something isn't working

Comments

@nick-ge
Copy link

nick-ge commented Dec 5, 2022

Dear caddy-docker maintainer,

I've tried to build a custom image from your Alpine Dockerfile (caddy-docker/2.6/alpine/Dockerfile) with the following command:

docker build --tag <custom-tag> .

During the building process I encountered the following error message:

Step 6/18 : RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
 ---> Running in 3762efc54156
The command '/bin/sh -c [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf' returned a non-zero code: 1

I guess there might be a mistake since the test command checks if /etc/nsswitch.conf is not available and in case write to it. You probably mean to check whether /etc/nsswitch.conf is indeed available. So no exclamation mark in test command. I guess the RUN statement was supposed to look like the following:

RUN [ -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf

Correct me if I'm wrong or missing something.

Best regards!

@abjugard
Copy link
Contributor

It looks like /etc/nsswitch.conf already contains the line hosts: files dns in the chosen alpine base image, so that line is unnecessary, and it's failing because the line returns false without an || statement, causing the build to fail.

I would just remove the line entirely as it doesn't seem necessary.

@francislavoie
Copy link
Member

@abjugard thanks for pointing that out.

Looks like the nsswitch stuff was removed from the golang Docker image in docker-library/golang@d66a926 since it's no longer needed as you said.

@hairyhenderson I guess we should remove it from here now as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants