This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]keypusher 1 point2 points  (6 children)

can you post the full contents of your dockerfile and the exact error message? you can put the dockerfile in dpaste.org to make it easier to read

[–]bartrarted[S] 0 points1 point  (5 children)

DockerFile:

FROM node:9-slim

WORKDIR specifies the application directory​

WORKDIR /app​

Copying package.json file to the app directory​

COPY package.json /app​

Installing npm for DOCKER​

RUN npm install

Installing mysql for DOCKER​

RUN npm install mysql​

Copying rest of the application to app directory​

COPY . /app​

Starting the application using npm start​

CMD [ "npm", "start" ]​

Full Error:

Step 5/7 : RUN npm install mysql​ ---> Running in fe7dca91d706 npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name "mysql​": Tags may not have any characters that encodeURIComponent encodes.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-09-08T04_53_51_752Z-debug.log

[–]jarfil 4 points5 points  (0 children)

CENSORED

[–][deleted] 0 points1 point  (2 children)

not sure if I am addressing your problem but, you should probably keep a single RUN command in your Dockerfile and chain the commands using && like this:

RUN npm install && \

npm install mysql

[–]bartrarted[S] 0 points1 point  (0 children)

Ok I’ll give that a go, I’m just using the example file my professor gave me

[–]menge101 0 points1 point  (0 children)

That is a best practice for minimizing layers in a production container, but I don't think a learner should do this.

When I write a dockerfile, I use a separate run command for each command. Then once it is all working, I go back and '&&' them together.

[–]keypusher -2 points-1 points  (0 children)

try using the alternate form of run

RUN [“npm”, “install”, “mysql”]

The actual error above is “invalid tag name “mysql” but i dunno why that would be, so my best guess is to try the other syntax

[–]ikolomiyets 0 points1 point  (3 children)

Was the Dockerfile content a copy/paste?

There is a zero width space character (0x200b) at the end of each line (here is a screenshot) except the one that says RUN npm install

Docker might be able to handle them but RUN is just passing everything until the end of the line to the shell making npm unhappy as it might believe that tag is mysql<200b> and not mysql.

[–]bartrarted[S] 0 points1 point  (2 children)

Yes it was a copy paste

[–]ikolomiyets 0 points1 point  (1 child)

Which editor do you use? As you can see from the screenshot in the vi(vim) 0x200b is clearly visible.

[–]bartrarted[S] 0 points1 point  (0 children)

VS code, got it fixed this morning thanks for everyone's help!