D
D
DeNissss44442021-11-10 03:31:36
HTML
DeNissss4444, 2021-11-10 03:31:36

Why can't I run the html file in docker?

I just started learning docker, I decided to try to run a regular html file through tomcat using docker. I opened the package with the project where this html file exists, and created a Dockerfile at the very root

FROM tomcat
    WORKDIR /app
    COPY . .
    RUN npm install
    EXPOSE 3000

    CMD ["tomcat","index.html"]


As I understand it, I should open the index.html file on the tomcat platform on port 3000, but the place of this gives me an error: Step 4/6 : RUN "npm" install
---> Running in aa9968fa65a1
/bin/sh: 1: npm: not found
Error response from daemon: The command '/bin/sh -c "npm" install' returned a non-zero code: 127
Failed to deploy 'my-container-2 Dockerfile: Dockerfile': Can't retrieve image ID from build stream

Please tell me what I'm doing wrong? Why is this error popping up? And in general, I understand correctly that this is exactly what I need to write to open a regular html file in tomcat

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2021-11-10
@leahch

1) tomcat is a web application server that is written in Java , and the server itself is also written in Java . You can't run html in it, but you can run war or jar files !
2) html cannot be run at all! it can only be published to a web server that will serve it. I recommend doing this, for example, through nginx or apache http or nodejs .
3) I do not recommend serving html through tomcat if you do not program in java and related to the JVMprogramming languages ​​( kotlin , groovy , clojure , etc.)

O
Orkhan Hasanli, 2021-11-10
@azerphoenix

Good afternoon.
You don't need a tomcat. It's expensive and inconvenient.
You need nginx.
Read this article:
https://medium.com/code-to-express/https-medium-co...
or this one:
https://www.dailysmarty.com/posts/steps-for-deploy. ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question