1

I am trying to run a docker container to automatically set up a sphinx documentation site, but for some reason I get the following error when I try to build

Step 9/11 : RUN make html
 ---> Running in abd76075d0a0
make: *** No rule to make target 'html'.  Stop.

When I run the container and console in, I see that sphinx-quickstart does not seem to have been run since there are no files present at all in /sphinx. Not sure what I have done wrong. Dockerfile is below.

  1 # Run this with                                                                                                                                                                                                
  2 # docker build .
  3 # docker run -dit -p 8000:8000 <image_id>
  4 FROM ubuntu:latest
  5 
  6 WORKDIR /sphinx
  7 VOLUME /sphinx
  8 
  9 RUN apt-get update -y
 10 RUN apt-get install python3 python3-pip vim git -y
 11 
 12 RUN pip3 install -U pip
 13 RUN pip3 install sphinx
 14 
 15 RUN sphinx-quickstart . --quiet --project devops --author 'Timothy Pulliam' -v '0.1' --language 'en' --makefile
 16 RUN make html
 17 
 18 EXPOSE 8000/tcp
 19 
 20 
 21 CMD ["python3", "-m", "http.server"]

EDIT:

Using LinPy's suggestion I was able to get it to work. It is still strange that it would not work the other way.

Timothy Pulliam
  • 132
  • 1
  • 9
  • 25

3 Answers3

1

so you need to set those in one line:

RUN sphinx-quickstart . --quiet --project devops --author 'Timothy Pulliam' -v '0.1' --language 'en' --makefile && make html

I think you can see in the logs , remove intermediate container there for the rule html is not there anymore

LinPy
  • 16,987
  • 4
  • 43
  • 57
1

The Dockerfile VOLUME directive mostly only has confusing side effects. Unless you’re 100% clear on what it does and why you want it, you should just delete it.

In particular, one of those confusing side effects is that RUN commands that write into the volume directory just get lost. So when on line 7 you say VOLUME /sphinx, the RUN sphinx-quickstart on line 15 tries to write its output into the current directory, which is a declared volume directory, so the output content isn’t persisted into the image.

(Storing your code in a volume isn’t generally appropriate; build it into the image so it’s reusable later. You can use docker run -v to bind-mount content over any container-side directory regardless of whether or not it’s declared as a VOLUME.)

David Maze
  • 130,717
  • 29
  • 175
  • 215
-1

You've already resolved the issue with LinPy's helpful comment, but just to add more, doing a quick google search with your error message comes up with this StackOverflow post... gcc makefile error: "No rule to make target ..."

Perhaps you were accidentally invoking a different command (in this case a GCC command) rather than the .bat file provided by Sphinx.

Hopefully this might shed a bit more light on WHY it was happening. I assume the Ubuntu parent image you're using has GCC pre-installed.

Dom
  • 213
  • 3
  • 10
  • I did look at that answer, however in my case the Makefile was missing entirely. But thanks for the answer. – Timothy Pulliam Aug 20 '19 at 12:41
  • @TimothyPulliam I'm glad you found the cause of the issue. My answer wasn't technically wrong since you was invoking the GCC command due to the absence of the Makefile, just saying since this was down-voted but I wouldn't consider my answer completely incorrect. – Dom Aug 20 '19 at 14:25
  • I just don't want people in the future to think it will solve this particular issue, although you are correct it does solve another issue. – Timothy Pulliam Aug 23 '19 at 01:36