0

I installed the docker on the Windows machine. Then I exposed the docker daemon to the localhost for the docker HTTP API usage.

Then I wrote simple Dockerfile and try to build it in the following way:

curl http://localhost:2375/build?dockerfile=/build?dockerfile=file:///D:/AAA/Dockerfile&t=ooouuu

But in the response I received followed error:

{"message":"page not found"}
"t" is not internal or external command, executable command or package file

If I understand correctly I used parameters in wrong way. Is it true? How it could be fixed?

AeroSun
  • 2,401
  • 2
  • 23
  • 46
  • You need to make sure to quote your command-line arguments: your local shell is splitting the command on the `&`. You also need to include the build context as a tar file in the POST body (you can't pass a `file:` URL in the query string like that). Also **turn off HTTP access to the daemon**: it is incredibly dangerous. A [Docker SDK](https://docs.docker.com/engine/api/sdk/) might be easier to use than manual `curl` commands. – David Maze Dec 18 '20 at 16:36
  • @David Maze, Hi! Thank you for the answer! Yes, I know that Docker SDK is much better but I need use HTTP API in privat network (it is company policy). You said that build context should be as tar file. Could you please give a some sample of query string? Also I don`t understand what is the context? Is it Dockerfile? So I just need to compress Dockerfile? – AeroSun Dec 19 '20 at 15:09
  • To be absolutely clear: anyone who can reach the Docker socket can **trivially root the host**. I'd recommend using a dedicated continuous-integration system to build images, or else use local `docker` CLI commands over an ssh connection. – David Maze Dec 19 '20 at 15:11
  • @DavidMaze, thx, I solve all troubles) The look from my side: I work on some kind of automation, I am write some kind of continuous-integration system. In my case any local docker CLI commands completely unusable, because they are needs a lot of work with parsing and error handling. So I have only one usable way - that is HTTP access – AeroSun Apr 01 '21 at 14:22

0 Answers0