Welcome to the Linux Foundation Forum!

03. Build - Creating the Dockerfile

abelpatel Posts: 13
edited September 2023 in LFD259 Class Forum


I am going through the LFD259 course, I'm on chapter 3 on "Creating the Dockerfile".

In this section, the instructions says to create a "Dockerfile" and then run

sudo docker build -t simpleapp

However I get the below message:

ERROR: "docker buildx build" requires exactly 1 argument.

So I then copied the Dockerfile from the Lab exercise folder so it contains this.

FROM python:3
ADD simple.py /
## RUN pip install pystrich
CMD [ "python", "./simple.py" ]

The directory also contains all of the other files in LFD259\SOLUTIONS\s_03.

Am I doing something wrong? Any help is appreciated, I've not worked on Docker before so I have a basic knowledge.

I've also tried

sudo docker build -t simpleapp -f Dockerfile

The slide doesn't mention anything else that I need to do.


  • fazlur.khan

    Hello @abelpatel

    What you are missing is the "Build Context" ... The relative or absolute path to a local directory..

    Try this ...

    sudo docker build -t simpleapp . # Note there is period at the end of the command - which means current directory. You are missing that in your command.


    sudo docker build -t simpleapp /path/where/dockerfile

    Example : sudo docker build -t simpleapp /home/student/myapp

  • abelpatel

    @fazlur.khan - thank you. that did the trick.

  • chrispokorni
    chrispokorni Posts: 2,200
    edited September 2023

    Hi @abelpatel,

    When selecting the command for copy/paste you omitted the "dot" at the very end, which supplies the working directory as the required build context.

    Assuming you were already in /home/<student>/app1/ the command should have been:
    sudo docker build -t simpleapp .


  • abelpatel

    @chrispokorni - thanks. I did add the "." at the end and it worked.

    In the slide it doesn't have the "." at the end of the command which caused the confusion on my behalf.

  • fcioanca
    fcioanca Posts: 1,949

    Hi @abelpatel,

    You should be following the lab pdf instructions, which do include the "."



Upcoming Training