My api-server
Dockerfile
is following
FROM node:alpine
WORKDIR /src
COPY . .
RUN rm -rf /src/node_modules
RUN rm -rf /src/package-lock.json
RUN yarn install
CMD yarn start:dev
After docker-compose up -d
I tried
$ docker exec -it api-server sh
/src # curl 'http://localhost:3000/'
sh: curl: not found
Why is the command curl
not found?
My host is Mac OS X.
Curl is URL retrieval (download/upload) command-line utility and library. It is free software for Alpine Linux. This page explains how to search and install curl on Alpine Linux using the apk command.
Like it says, it's a docker image built on alpine with curl installed. Size 5.93 MB.
node:alpine
image doesn't come with curl
. You need to add the installation instruction to your Dockerfile.
RUN apk --no-cache add curl
Full example from your Dockerfile would be:
FROM node:alpine
WORKDIR /src
COPY . .
RUN rm -rf /src/node_modules
RUN rm -rf /src/package-lock.json
RUN apk --no-cache add curl
RUN yarn install
CMD yarn start:dev
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