1

I am trying to upload image of my angular 9 application into Docker hub. I have docker extension already installed in my visual studio code, and I connected it to my username and added my account password.

Then, I ran the following command to install docker globally:

npm install -g docker

At the root path of my project, I've created Dockerfile having the following script:

# Stage 1
FROM node:latest as node
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build --prod

# Stage 2
FROM nginx:alpine
COPY --from=node /app/dist/myproject /usr/share/nginx/html

And then I tried:

FROM 13.13.0-alpine3.10 as build-step
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY . /app/
RUN npm run build

FROM nginx:1.17.10-alpine as prod-step
COPY --from=build-step /app/dist/myproject /usr/share/nginx/html
# COPY /dist/myproject /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

I then tried to build my application using:

docker build --rm -f "Dockerfile" -t myproject:latest "."

And I've got the following response instead of building the app:

Saved file tree to doc-filelist.js

Copied JS to doc-script.js

Compiled CSS to doc-style.css

And a doc folder has been created. But nothing else has been done.

I tried this solution on stack overflow using docker.js but I don't think it is the solution I want to build a docker image and upload to docker hub and run it from there.

alim1990
  • 4,656
  • 12
  • 67
  • 130
  • 1
    `FROM 13.13.0-alpine3.10`. Looks like you are trying to reference a `node` image here? Should it be: `FROM node:13.13.0-alpine3.10`? Also the answer you are referencing points out that you are calling `docker.js` instead of a true Docker Engine. Try installing Docker Engine here: https://docs.docker.com/engine/install/. – wearego Apr 17 '20 at 07:51

1 Answers1

0

You're not installing the Docker Engine you want with that npm command. This is how you install Docker Engine: https://docs.docker.com/engine/install. After that you can try to build your Dockerfile.

Also your image name seems wrong: FROM 13.13.0-alpine3.10. Looks like you are trying to reference a node image here? Should it be: FROM node:13.13.0-alpine3.10?

wearego
  • 178
  • 10