October 23, 2024
Chicago 12, Melborne City, USA
HTML

Set reference in HTML file to copied file in docker


I copy the logo to my container defining the following part in my Dockerfile.

COPY ./frontend/src/assets/my_logo.png frontend/my_logo.png

I can see that the file was copied to frontend/my_logo.png starting the container(-p 8090:8080 –hostname frontendTest).

Now, I want to use my_logo.png in my HTML.

 <img
        class="my-class"
        alt="alt"
        src="http://localhost:8090/frontend/my_logo.png"
      />

I also tried the following options

src="/frontend/my_logo.png"
src="frontendTest/frontend/my_logo.png"

How can I set the right src to get my copied file?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video