How to fix error occurring during Docker image build: "E: Unsupported file /tmp given on commandline"

Viewed 5037

I am trying to build an image from Dockerfile and I am getting below error:

E: Unsupported file /tmp given on commandline

This is my dockerfile:

FROM python:3.7-slim-stretch
LABEL version="0.1"

ENV DAEMON_RUN=true
ENV SPARK_VERSION=2.4.4
ENV HADOOP_VERSION=2.7
ENV SCALA_VERSION=2.12.4
ENV SCALA_HOME=/usr/share/scala
ENV SPARK_HOME=/spark

RUN apt-get update -yqq
RUN apt-get install -yqq --no-install-recommends \
         wget \
         tar \
         bash \
         vim \
         less \


RUN cd "/tmp"

But when i run below line I'm getting mentioned error:

docker build --rm -t test/docker-airflow-spark -f Dockerfile-Spark >.

If i remove the last command : RUN cd "/tmp" And i try to connect ssh to the container the folder exists

Any ideas?

1 Answers

you need to edit the last line in apt-get command change less \ to less

docker thinks that RUN cd "/tmp" is a parameter for apt-get

anyway you should use WORKDIR if you want to use /tmp for further steps

Related