mkdir is not executing in Dockerfile/build
Asked Answered
M

2

8

There is already a question, with answer, under a similar title, but the title isn't really outlining the true question. mkdir is in fact executing for the other question/thread. It is just failing...

Whereas I've:

RUN mkdir -p /home/developer And I get: Step 18 : RUN MKDIR Unknown instruction: RUN MKDIR

That is ACTUALLY not executing.

Here is the Docker file from line 1. All of these steps succeed, until mkdir.

FROM ubuntu:14.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y purge php.*
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y wget
RUN apt-get install -y build-essential
RUN wget http://xmlsoft.org/sources/libxml2-2.8.0.tar.gz
RUN tar -xvf libxml2-2.8.0.tar.gz
WORKDIR libxml2-2.8.0
RUN ./configure && make && make install
RUN apt-get install -y make
# build php
RUN wget http://museum.php.net/php5/php-5.4.0.tar.bz2
RUN tar -xvf php-5.4.0.tar.bz2
WORKDIR php-5.4.0
RUN ./configure && make
RUN make install
# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000
# −p, −−parents -> no error if existing, make parent directories as needed
RUN mkdir -p /home/developer
Menial answered 13/1, 2016 at 19:13 Comment(0)
S
8

There's an interesting character between RUN and mkdir in your Dockerfile. Replacing it with a space makes your Dockerfile build.

docker build output with yours:

Sending build context to Docker daemon 2.048 kB
Step 1 : FROM ubuntu:14.04
 ---> c4bea91afef3
Step 2 : RUN MKDIR
Unknown instruction: RUN MKDIR

docker build output with fixed:

Sending build context to Docker daemon 2.048 kB
Step 1 : FROM ubuntu:14.04
 ---> c4bea91afef3
Step 2 : RUN mkdir -p /home/developer
 ---> Using cache
 ---> 1ac57f7c9ccd
Successfully built 1ac57f7c9ccd
Salary answered 14/1, 2016 at 0:21 Comment(4)
>>> And you found that via hexmode/xxd in vim. <<< I can't thank you enough. I'm embarrased to say how many hours I've been stuck on this mystery! More on that: vim.wikia.com/wiki/Improved_hex_editingMenial
Was it a tab? What version of docker are you using? I think it would make sense to make the builder accept both "tabs" and "spaces" instead of erroring out.Foothold
No, it was from working in Windows at some point, and then back in Linux the char seems to have been added by editing in Windows.Menial
The problem is mkdir MUST be in lowercase.Veloz
F
0

mkdir should be lowercase. I received "MKDIR: not found" when using uppercase MKDIR.

Faso answered 25/9, 2020 at 19:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.