Home > database >  Dockerfile not recognized when trying to create it
Dockerfile not recognized when trying to create it

Time:12-09

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"]

CodePudding user response:

If you are trying to build an image from a local Dockerfile, given your current bash location is in the same folder where Dockerfile resides - all you have to do is

docker build .

CodePudding user response:

As written in the docs, Docker uses the file named Dockerfile by default. If you want to specify the file you can use the option --file or -f of the docker build command.

In your case you can just use to solve your problem:

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

But if you want to specify another file named TestDockerfile (example for testing):

docker build -t serious-game:0.0.1 -t serious-game:latest -f TestDockerfile .
  • Related