Dockerfile not recognized when trying to build from it?

I am trying to build a Docker image from a dockerfile command I received from the previous developer:

bash-5.1$ ls
data_collection      demo.py	 examples   requirements.txt  start.py
demonstrateur.ipynb  Dockerfile  README.md  serious_game      test
bash-5.1$ docker build Dockerfile .
    
    Usage:  docker build [OPTIONS] PATH | URL | -
    
    Build an image from a Dockerfile

I also tried with

    bash-5.1$ docker build -t serious-game:0.0.1 -t serious-game:latest Dockerfile .

and already completely reinstalled docker by following this tutorial but it gave the same error.

Here is my Dockerfile content:

bash-5.1$ cat Dockerfile 

FROM nvidia/cuda:10.2-base-ubuntu18.04
MAINTAINER me

EXPOSE 5555
EXPOSE 8886

ENV DEBIAN_FRONTEND noninteractive
ENV WD=/home/serious-game/
WORKDIR ${WD}


# Add git and ssh
RUN apt-get -y update && \
    apt-get -y upgrade && \
    apt-get -y install git ssh pkg-config python3-pip python3-opencv

# Dépendances python
COPY requirements.txt  /requirements.txt
RUN cd / && \
     python3 -m pip install --upgrade pip && \
    pip3 install -r requirements.txt


CMD ["start.py"]

If the Dockerfile is called Dockerfile, then you don’t need to specify it. Or if you do specify it, you should use -f Dockerfile or --file Dockerfile.

Did you read the documentation about what the -t option is? I wonder if you can specify that twice. Bug again: you should not specify Dockerfile like that. What error do you get there?

So, to use the standard name Dockerfile and build from the current directory:

docker build -t serious-game:0.0.1 -t serious-game:latest .

(If you can indeed use -t twice to apply two tags in one go.)

1 Like

Its possible. I use it frequently.

1 Like