I am studying on Docker these days and confused that why RUN pwd
just does not seem to work while running my docker file.
I am working on IOS
and the full content of my docker file can be seen as below:
FROM ubuntu:latest
MAINTAINER xxx
RUN mkdir -p /ln && echo hello world > /ln/wd6.txt
WORKDIR /ln
RUpwd
CMD ["more" ,"wd6.txt"]
as far as my understanding, after building the docker image with the tag 'wd8'and running it, I supposed the result should show like this
~ % docker run wd8
::::::::::::::
wd6.txt
::::::::::::::
hello world
ln
however, the fact is without ln
.
I have tried with RUN $pwd
, and also added ENV at the beginning of my dockerfile, both do not work.
Please help point out where the problem is.
ps: so I should not expect to see the directory 'ln' on my disk, right? since it is supposed to be created within the container...?
[]
[]
There are actually multiple reasons you don't see the output of the pwd
command, some of them already mentioned in the comments:
RUN
statements in your Dockerfile
are only executed during the build stage, i.e. using docker build
and not with docker run
--progress=plain
flag--no-cache
flag