If define a multistage Dockerfile
like so:
FROM exampleabc:latest
COPY app.go .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /go/src/github.com/alexellis/href-counter/app .
CMD ["./app"]
Would the exampleabc:latest
have it's entrypoint executed?
With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don't want in the final image.
ENTRYPOINT instructions are used to build Dockerfiles meant to run specific commands. The above Dockerfile uses an ENTRYPOINT instruction that echoes Hello, Darwin when the container is running.
What happens if multiple ENTRYPOINT instructions are specified in one, single-stage Dockerfile? Only the first ENTRYPOINT instruction has any effect. The build will fail.
It's ok to have multiple processes, but to get the most benefit out of Docker, avoid one container being responsible for multiple aspects of your overall application. You can connect multiple containers using user-defined networks and shared volumes.
From official documentation:
Only the last ENTRYPOINT instruction in the Dockerfile will have an effect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With