Score:0

Unknown instruction: YUM while building Docker image

il flag

My Docker file:

FROM remote-host

COPY ./conf/nginx.repo /etc/yum.repos.d/nginx.repo

RUN
  yum -y install nginx-1.12.2 openssl --enablerepo=nginx &&
  yum -y install https://centos7.iuscommunity.org/ius-release.rpm &&
  yum -y install https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release -1.0-14.ius.centos7.noarch.rpm &&
  yum -y install
   php71u-fpm
   php71u-cli
   php71u-mysqlnd
   php71u-soap
   php71u-xml
   php71u-zip
   php71u-json
   php71u-mcrypt
   php71u-mbstring
   php71u-zip
   php71u-gd
    --enablerepo=ius && yum clean all

EXPOSE 80 443

VOLUME /war/www/html /var/log/nginx /var/log/php-fpm /var/lib/php-fpm

COPY ./conf/nginx.conf /etc/nginx/conf.d/default.conf

COPY ./bin/start.sh /start.sh

RUN chmod +x /start.sh'

I am trying to install the PHP packages by running the docker file to create an image.

But while running Docker-compose getting the below error:

Building remote_host
Sending build context to Docker daemon  5.632kB
Step 1/8 : FROM centos
 ---> 5d0da3dc9764
Step 2/8 : RUN yum -y install openssh-server
 ---> Using cache
 ---> f35cb2e631df
Step 3/8 : RUN useradd remote_user &&     echo "remote_user:1234" | chpasswd &&     mkdir /home/remote_user/.ssh &&     chmod 700 /home/remote_user/.ssh
 ---> Using cache
 ---> cd43cbb20a17
Step 4/8 : COPY remote-key.pub /home/remote_user/.ssh/authorized_keys
 ---> Using cache
 ---> 265df27dac01
Step 5/8 : RUN chown remote_user:remote_user -R /home/remote_user/.ssh/ &&     chmod 700 /home/remote_user/.ssh/authorized_keys
 ---> Using cache
 ---> ede2d6bc1ca1
Step 6/8 : RUN ssh-keygen -A
 ---> Using cache
 ---> d2285793a0a0
Step 7/8 : RUN yum -y install mysql
 ---> Using cache
 ---> 5e32bcb6c255
Step 8/8 : CMD /usr/sbin/sshd -D
 ---> Using cache
 ---> 96a4c1781a8f
Successfully built 96a4c1781a8f
Successfully tagged remote-host:latest
Building web
Sending build context to Docker daemon  8.192kB
Error response from daemon: dockerfile parse error line 6: unknown instruction: YUM
ERROR: Service 'web' failed to build : Build failed
Massimo avatar
ng flag
Use the full path for `yum`.
Score:2
pt flag

You have syntax errors in your Dockerfile. You can't put commands across multiple lines in a Dockerfile without escaping the end-of-line. That is, you can't write this:

RUN
  yum -y install nginx-1.12.2 openssl --enablerepo=nginx &&
  yum -y install https://centos7.iuscommunity.org/ius-release.rpm

But you can write this:

RUN yum -y install nginx-1.12.2 openssl --enablerepo=nginx &&  yum -y install https://centos7.iuscommunity.org/ius-release.rpm

Or you can write this:

RUN \
  yum -y install nginx-1.12.2 openssl --enablerepo=nginx && \
  yum -y install https://centos7.iuscommunity.org/ius-release.rpm

Here, we use the \ character to escape the end-of-line, allowing us to spread a command across multiple physical lines in our Dockerfile.

So your first RUN command should probably look like:

RUN \
  yum -y install nginx-1.12.2 openssl --enablerepo=nginx && \
  yum -y install https://centos7.iuscommunity.org/ius-release.rpm && \
  yum -y install https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release -1.0-14.ius.centos7.noarch.rpm && \
  yum -y install \
   php71u-fpm \
   php71u-cli \
   php71u-mysqlnd \
   php71u-soap \
   php71u-xml \
   php71u-zip \
   php71u-json \
   php71u-mcrypt \
   php71u-mbstring \
   php71u-zip \
   php71u-gd \
    --enablerepo=ius && yum clean all
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.