This is just a piece of a Dockefile that's confusing me. It has some extra debugging lines in it by the way. In the first line I create /home/ubuntu/.bashrc. However then at the last line, it acts as if it cannot run it.
RUN echo 'source /opt/ros/kinetic/setup.bash' >> /home/ubuntu/.bashrc
RUN echo 'source /home/ubuntu/catkin_ws/devel/setup.bash' >> /home/ubuntu/.bashrc
RUN /bin/bash -c "echo 'export HOME=/home/ubuntu' >> /root/.bashrc && source /root/.bashrc"
RUN pwd
RUN cd ~ && pwd
RUN cat /home/ubuntu/.bashrc
RUN mkdir -p ~/catkin_ws/src
RUN source /home/ubuntu/.bashrc && \
cd ~/catkin_ws/src && \
/opt/ros/kinetic/bin/catkin_init_workspace && \
cd ~/catkin_ws && \
catkin_make
Here's the output:
Step 13/32 : RUN echo 'source /opt/ros/kinetic/setup.bash' >> /home/ubuntu/.bashrc
---> Using cache
---> a60c2d1482d8
Step 14/32 : RUN echo 'source /home/ubuntu/catkin_ws/devel/setup.bash' >> /home/ubuntu/.bashrc
---> Using cache
---> 3be964ee0c36
Step 15/32 : RUN /bin/bash -c "echo 'export HOME=/home/ubuntu' >> /root/.bashrc && source /root/.bashrc"
---> Using cache
---> 83cf2e5f4b1c
Step 16/32 : RUN pwd
---> Using cache
---> 40915ecc834d
Step 17/32 : RUN cd ~ && pwd
---> Using cache
---> 92f2cee78a48
Step 18/32 : RUN cat /home/ubuntu/.bashrc
---> Using cache
---> c8f467775b33
Step 19/32 : RUN mkdir -p ~/catkin_ws/src
---> Using cache
---> 53e5c403949f
Step 20/32 : RUN source /home/ubuntu/.bashrc && cd ~/catkin_ws/src && /opt/ros/kinetic/bin/catkin_init_workspace && cd ~/catkin_ws && catkin_make
---> Running in 708d485325e2
/bin/sh: 1: source: not found
The command '/bin/sh -c source /home/ubuntu/.bashrc && cd ~/catkin_ws/src && /opt/ros/kinetic/bin/catkin_init_workspace && cd ~/catkin_ws && catkin_make' returned a non-zero code: 127
Naturally, it's my bug but I cant see it nor the gap in my understanding.Thanks!
source is not a valid command, it's a bash builtin.
It's not telling you that the file /home/ubuntu/.bashrc but that source is not a command
Just put the RUN parameter in a sh script, started correctly with #!/bin/bash.
Then just copy the sh to the container using COPY, and run it with RUN.
Don't forget to give the exec permission to the script:
COPY script.sh /
RUN ["chmod", "+x", "/script.sh"]
RUN /script.sh
Or:
RUN /bin/bash -c "source ...."
As pointed out by #michael_bitard, source is a bash built-in. Default shell in ubuntu is dash as can be seen here:
# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 22 17:49 /bin/sh -> dash
To use bash to run the command, change the RUN instruction to
RUN cd ~/catkin_ws/src && \
/opt/ros/kinetic/bin/catkin_init_workspace && \
cd ~/catkin_ws && \
/bin/bash -c "source /home/ubuntu/.bashrc; catkin_make"
Another option is to set the BASH_ENV environment variable, which should source the specified file (/home/ubuntu/.bashrc) before running the bash script catkin_make as mentioned here.
ENV BASH_ENV /home/ubuntu/.bashrc
RUN cd ~/catkin_ws/src && \
/opt/ros/kinetic/bin/catkin_init_workspace && \
cd ~/catkin_ws && \
/bin/bash -c "catkin_make"
Related
I am creating a nvidia-docker image with the following included in the Dockerfile:
RUN curl -so /miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && chmod +x /miniconda.sh && /miniconda.sh -b -p /miniconda && rm /miniconda.sh
ENV PATH=/miniconda/bin:$PATH
#this is stored in cache ---> fa383a2e1344
# check path
RUN /miniconda/bin/conda
I get the following error:
/bin/sh: 1: /miniconda/bin/conda: not found
The command '/bin/sh -c /miniconda/bin/conda' returned a non-zero code: 127
When I test the path using:
nvidia-docker run --rm fa383a2e1344 ls
then /miniconda does not exist hence the error.
I then altered the Dockerfile to replace /miniconda with a env var path ie:
ENV CONDA_DIR $HOME/miniconda
# Install Miniconda
RUN curl -so /miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& chmod +x /miniconda.sh \
&& /miniconda.sh -b -p CONDA_DIR \
&& rm /miniconda.sh
ENV PATH=$CONDA_DIR:$PATH
# check path
RUN $CONDA_DIR/conda
And get the error:
/bin/sh: 1: /miniconda/conda: not found
The command '/bin/sh -c $CONDA_DIR/conda' returned a non-zero code: 127
I was able to get it working by setting the path to current dir rather than hitting /
WORKDIR /miniconda
RUN curl -so ./miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& chmod +x ./miniconda.sh \
&& ./miniconda.sh -b -p CONDA_DIR
Here is the build result for reference
docker build - < Dockerfile
Sending build context to Docker daemon 3.072kB
Step 1/5 : FROM node:12.16.0-alpine
---> 466593119d17
Step 2/5 : RUN apk update && apk add --no-cache curl
---> Using cache
---> 1d6830c38dfa
Step 3/5 : WORKDIR /miniconda
---> Using cache
---> 8ee9890a7109
Step 4/5 : WORKDIR /miniconda
---> Running in 63238c179aea
Removing intermediate container 63238c179aea
---> 52f571393bf6
Step 5/5 : RUN curl -so ./miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && chmod +x ./miniconda.sh && ./miniconda.sh -b -p CONDA_DIR
---> Running in b59e945ad7a9
Removing intermediate container b59e945ad7a9
---> 74ce06c9af66
Successfully built 74ce06c9af66
I have a Dockerfile which was originally pulling from ubuntu and I recently came across alpine which is more lightweight so would like to pull from that instead. Part of the code I'm trying to build is called Healpix which depends on cfitsio. When I originally built the ubuntu version I found this Dockerfile https://github.com/MilesCranmer/dockers/blob/master/dockerfiles/healpix.
Essentially the problem is the following works in ubuntu but not with alpine:
RUN echo "3\ngfortran\n\nY\n\n\ngcc\n\n\n\n\nN\n1\nY\nN\nN\n0\n" |
./configure && make
The error I get is
Something went wrong ...
Quitting configuration script !
./configure: exit: line 162: Illegal number: -1
The command '/bin/sh -c echo "3\ngfortran\n\nY\n\n\ngcc\n\n\n\n\nN\n1\nY\nN\nN\n0\n" | ./configure && make' returned a non-zero code: 2
somewhat confusingly the configure script in question isn't 162 lines long https://sourceforge.net/p/healpix/code/HEAD/tree/branches/branch_v350r1006/configure. I have tried installing bash and changing script to that but that didn't work.
ubuntu Dockerfile
FROM ubuntu
RUN apt-get update && apt-get install -y gcc g++ gfortran make wget
WORKDIR /home
RUN wget \
http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio_latest.tar.gz \
&& tar xzf cfitsio_latest.tar.gz
WORKDIR cfitsio
RUN ./configure --prefix=/usr && make && make install
WORKDIR /home
RUN wget \
https://sourceforge.net/projects/healpix/files/Healpix_3.50/Healpix_3.50_2018Dec10.tar.gz \
&& tar xzf Healpix*.tar.gz
WORKDIR Healpix_3.50
RUN echo \
"3\ngfortran\n\nY\n\n\ngcc\n\n\n\n\nN\n1\nY\nN\nN\n0\n" | ./configure \
&& make
alpine Dockerfile
FROM alpine
RUN apk --no-cache add gcc g++ gfortran make wget
WORKDIR /home
RUN wget \
http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio_latest.tar.gz \
&& tar xzf cfitsio_latest.tar.gz
WORKDIR cfitsio
RUN ./configure --prefix=/usr && make && make install
WORKDIR /home
RUN wget \
https://sourceforge.net/projects/healpix/files/Healpix_3.50/Healpix_3.50_2018Dec10.tar.gz \
&& tar xzf Healpix*.tar.gz
WORKDIR Healpix_3.50
RUN echo \
"3\ngfortran\n\nY\n\n\ngcc\n\n\n\n\nN\n1\nY\nN\nN\n0\n" | ./configure \
&& make
TL;DR
In your Dockerfile, use :
RUN /bin/echo -e "3\ngfortran\n[...]" | ./configure && make
to have the same behavior on Ubuntu and Alpine.
Explanations
The ./configure script is executed with /bin/sh (see the shebang). On Ubuntu, /bin/sh is a link to /bin/dash, while on Alpine, /bin/sh is a link to /bin/busybox.
The following small example reproduces your problem.
Consider the following ./configure script :
#!/bin/sh
read -p "1st prompt : " first
read -p "2nd prompt : " second
echo "$first-$second"
On Ubuntu :
docker run --rm -v $PWD/configure:/configure ubuntu:18.04 \
/bin/sh -c 'echo "a\nb" | ./configure'
prints :
a-b
While, on Alpine :
docker run --rm -v $PWD/configure:/configure alpine:3.8 \
/bin/sh -c 'echo "a\nb" | ./configure'
prints :
anb-
On Alpine (busybox), the echoed string (a\nb) is interpreted as a single argument, while on Ubuntu (dash), the \n is used to separate both arguments.
To have the same behavior as Ubuntu on Alpine, you can run :
docker run --rm -v $PWD/configure:/configure alpine:3.8 /bin/sh -c 'echo "a
b
" | ./configure'
or :
docker run --rm -v $PWD/configure:/configure alpine:3.8 /bin/sh -c \
'echo -e "a\nb" | ./configure'
(see the -e parameter of echo)
These 2 commands print :
a-b
As for your Dockerfile, you should write something like :
RUN /bin/echo -e "3\ngfortran\n[...]" | ./configure && make
/bin/echo is used instead of echo because on Ubuntu, echo -e "3\ngfortran\n[...]" will print -e 3\nngfortran\n[...].
This is because echo is parsed a shell built-in, while /bin/echo is explicitly not (source : https://github.com/moby/moby/issues/8949#issuecomment-61682684).
I am trying configure and run a certain program using Docker. I am a beginner in Docker, so beware of newbie mistakes!
FROM ubuntu:16.04
# create non-root user
ENV USERNAME ros
RUN adduser --ingroup sudo --disabled-password --gecos "" --shell /bin/bash --home /home/$USERNAME $USERNAME
RUN bash -c 'echo $USERNAME:ros | chpasswd'
ENV HOME /home/$USERNAME
RUN apt-get update && apt-get install --assume-yes wget sudo && \
wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_kinetic.sh && \
chmod 755 ./install_ros_kinetic.sh && \
bash ./install_ros_kinetic.sh
RUN apt-get install --assume-yes ros-kinetic-joy ros-kinetic-teleop-twist-joy ros-kinetic-teleop-twist-keyboard ros-kinetic-laser-proc ros-kinetic-rgbd-launch ros-kinetic-depthimage-to-laserscan ros-kinetic-rosserial-arduino ros-kinetic-rosserial-python ros-kinetic-rosserial-server ros-kinetic-rosserial-client ros-kinetic-rosserial-msgs ros-kinetic-amcl ros-kinetic-map-server ros-kinetic-move-base ros-kinetic-urdf ros-kinetic-xacro ros-kinetic-compressed-image-transport ros-kinetic-rqt-image-view ros-kinetic-gmapping ros-kinetic-navigation ros-kinetic-interactive-markers
RUN cd /home/$USERNAME/catkin_ws/src/
RUN git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
RUN git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
USER $USERNAME
WORKDIR /home/$USERNAME
# add catkin env
RUN echo 'source /opt/ros/kinetic/setup.bash' >> /home/$USERNAME/.bashrc
RUN echo 'source /home/$USERNAME/catkin_ws/devel/setup.bash' >> /home/$USERNAME/.bashrc
RUN /bin/bash -c "source /home/ros/.bashrc && cd /home/$USERNAME/catkin_ws && catkin_make"
Gave the following output:
~/m/rosdocker docker build --rm -f "Dockerfile" -t rosdocker:latest .
Sending build context to Docker daemon 5.632kB
Step 1/15 : FROM ubuntu:16.04
---> b0ef3016420a
Step 2/15 : ENV USERNAME ros
---> Using cache
---> 25bf14574e2b
Step 3/15 : RUN adduser --ingroup sudo --disabled-password --gecos "" --shell /bin/bash --home /home/$USERNAME $USERNAME
---> Using cache
---> 3a2787196745
Step 4/15 : RUN bash -c 'echo $USERNAME:ros | chpasswd'
---> Using cache
---> fa4bc1d220a8
Step 5/15 : ENV HOME /home/$USERNAME
---> Using cache
---> f987768fa3b1
Step 6/15 : RUN apt-get update && apt-get install --assume-yes wget sudo && wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_kinetic.sh && chmod 755 ./install_ros_kinetic.sh && bash ./install_ros_kinetic.sh
---> Using cache
---> 9c26b8318f2e
Step 7/15 : RUN apt-get install --assume-yes ros-kinetic-joy ros-kinetic-teleop-twist-joy ros-kinetic-teleop-twist-keyboard ros-kinetic-laser-proc ros-kinetic-rgbd-launch ros-kinetic-depthimage-to-laserscan ros-kinetic-rosserial-arduino ros-kinetic-rosserial-python ros-kinetic-rosserial-server ros-kinetic-rosserial-client ros-kinetic-rosserial-msgs ros-kinetic-amcl ros-kinetic-map-server ros-kinetic-move-base ros-kinetic-urdf ros-kinetic-xacro ros-kinetic-compressed-image-transport ros-kinetic-rqt-image-view ros-kinetic-gmapping ros-kinetic-navigation ros-kinetic-interactive-markers
---> Using cache
---> 4b4c0abace7f
Step 8/15 : RUN cd /home/$USERNAME/catkin_ws/src/
---> Using cache
---> fb87caedbef8
Step 9/15 : RUN git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
---> Using cache
---> d2d7f198e018
Step 10/15 : RUN git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
---> Using cache
---> 42ddcbbc19e1
Step 11/15 : USER $USERNAME
---> Using cache
---> 4526fd7b5d75
Step 12/15 : WORKDIR /home/$USERNAME
---> Using cache
---> 0543c327b994
Step 13/15 : RUN echo 'source /opt/ros/kinetic/setup.bash' >> /home/$USERNAME/.bashrc
---> Using cache
---> dff40263114a
Step 14/15 : RUN echo 'source /home/$USERNAME/catkin_ws/devel/setup.bash' >> /home/$USERNAME/.bashrc
---> Using cache
---> fff611e9d9db
Step 15/15 : RUN /bin/bash -c "source /home/ros/.bashrc && cd /home/$USERNAME/catkin_ws && catkin_make"
---> Running in 7f26a34419a3
/bin/bash: catkin_make: command not found
The command '/bin/sh -c /bin/bash -c "source /home/ros/.bashrc && cd /home/$USERNAME/catkin_ws && catkin_make"' returned a non-zero code: 127
~/m/rosdocker
I need it to run catkin_make (which is on the path set up by .bashrc)
Exit code 127 from shell commands means "command not found". Is .bashrc executable? Normally it is not, probably you want to source it?
source ./home/$USERNAME/.bashrc
As Dan Farrel pointed out in his comment, sourcing the file in a RUN command will only have effect within that shell.
To source .bashrc during the build
If you want it to have effect for later commands in the build you need to run them all in the same RUN statement. In the below .bashrcis sourced in the same shell as catkin_make is run.
RUN . /home/ros/.bashrc && \
cd /home/$USERNAME/catkin_ws && \
catkin_make
To source the .bashrc file when the container starts
What should happen when the container is run using docker runis specified using the ENTRYPOINTstatement. If you just want a plain bash prompt, specify /bin/bash. The shell will be run with the user specified in the USER statement.
So in summary if you add the following to the end of your Dockerfile
USER ros
ENTRYPOINT /bin/bash
When someone runs the container using docker run -it <containerName> they will land in a bash shell as the user ros. Bash will automatically source the /home/ros/.bashrc file and all definitions inside will be available in the shell. (Your RUN statement containing the .bashrc file canbe removed
I've written this straightforward Dockerfile:
FROM alpine
WORKDIR /usr/src
RUN apk add --no-cache curl jq
RUN mkdir /env
COPY src/* /usr/src/
RUN chmod u+x /usr/src/*.sh
CMD /usr/src/wsec.sh
When I try to build the image, I'm getting this error message:
Sending build context to Docker daemon 43.52kB
Step 1 : FROM alpine
---> 3fd9065eaf02
Step 2 : WORKDIR /usr/src
---> Using cache
---> 4c7b79dc4239
Step 3 : RUN apk add --no-cache curl jq
---> Running in 0cf83217477a
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:
curl (missing):
required by: world[curl]
jq (missing):
required by: world[jq]
The command '/bin/sh -c apk add --no-cache curl jq' returned a non-zero code: 2
It could happen that main alpine repository http://dl-cdn.alpinelinux.org/alpine is temporary unavailable. Just like in your case. In order to be not blocked on this issue, we should add other alpine repositories to our alpine image:
http://dl-2.alpinelinux.org
http://dl-3.alpinelinux.org
http://dl-4.alpinelinux.org
http://dl-5.alpinelinux.org
So, the final Dockerfile is:
FROM alpine
WORKDIR /usr/src
RUN echo "http://dl-2.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-2.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories && \
echo "http://dl-3.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-3.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories && \
echo "http://dl-5.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-5.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories
RUN apk add --no-cache curl jq
RUN mkdir /env
COPY src/* /usr/src/
RUN chmod u+x /usr/src/*.sh
CMD /usr/src/wsec.sh
I wrote this docker-compose project. The docker-compose.yml looks like this:
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
www:
build: ./mGSV
restart: always
ports:
- 8080:8080
And the Dockerfile is based on a PHP container and looks like this.
FROM php:5-apache
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-7-jdk \
maven \
git \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/qunfengdong/mGSV.git
# Move the folder 'mgsv' to DocumentRoot of Apache web server. By default, the DocumentRoot of Apache is /var/www/ (speak to the system administrator to know the exact DocumentRoot).
RUN cd /var/www/html/mGSV \
&& mkdir tmp \
&& chmod -R 777 tmp
RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php \
&& sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php \
&& sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
RUN cd /var/www/html/mGSV/ws \
&& tar -xzf mgsv-ws-server.tar.gz
RUN cd /var/www/html/mGSV/ws/mgsv-ws-server \
&& mvn package
RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
RUN cd /var/www/html/mGSV/ws \
&& echo "mgsv_upload_url=http://localhost/mgsv" > config.properties \
&& echo "ws_publish_url=http\://localhost\:8081/MGSVService" >> config.properties \
&& java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
This is the output which I got:
Step 1/11 : FROM php:5-apache
---> 8f4a38cf4542
Step 2/11 : RUN apt-get update && apt-get install -y --no-install-recommends openjdk-7-jdk maven git && rm -rf /var/lib/apt/lists/*
---> Using cache
---> f194797b9362
Step 3/11 : RUN git clone https://github.com/qunfengdong/mGSV.git
---> Using cache
---> 4acd066da444
Step 4/11 : RUN cd /var/www/html/mGSV && mkdir tmp && chmod -R 777 tmp
---> Using cache
---> f766f9ceb7d3
Step 5/11 : RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php && sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php && sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
---> Using cache
---> 007dff8907f4
Step 6/11 : RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
---> Using cache
---> 026049ca32d8
Step 7/11 : RUN cd /var/www/html/mGSV/ws && tar -xzf mgsv-ws-server.tar.gz
---> Using cache
---> 92a0f85b27a0
Step 8/11 : RUN cd /var/www/html/mGSV/ws/mgsv-ws-server && mvn package
---> Using cache
---> 5aa1723f255f
Step 9/11 : RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
---> Using cache
---> f0dbd0ac1ddb
Step 10/11 : RUN cd /var/www/html/mGSV/ws && echo "mgsv_upload_url=http://localhost/mgsv" > config.properties && echo "ws_publish_url=http\://localhost\:8081/MGSVService" >> config.properties && java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
---> Using cache
---> 0c86c0adddd5
However, when I create an interactive session the /var/www/html/ is empty:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
php 5-apache 8f4a38cf4542 7 days ago 374MB
$ sudo docker run --entrypoint /bin/bash -i -t 8f4a38cf4542
root#a3908e297bcf:/var/www/html# ls
Why can't I see the /var/www/html/mGSV folder inside the docker container?
Thank you in advance.
Michal
The 8f4a38cf4542 image is the php:5-apache base image you are building FROM before all your additions.
The docker-compose build output should include a line: Successfully built eccdcc9a9534 at the end, which is the image ID you need to copy from your output and use. You should be able to find this image in the complete output:
docker images -a
To make life easier, add an image name to the www service so compose tags the build and it's easily accessable:
www:
build: ./mGSV
image: user3523406/www
restart: always
Then
sudo docker run --entrypoint /bin/bash -it user3523406/www