Philipp Brucker
Philipp Brucker

Reputation: 329

Docker API start container returns 404

I try to control a Docker server via the Docker remote API.

Commands like

/containers/json?all=1

or

/containers/15999301b96f/stats

are working perfectly fine. But as soon as I try to start, stop or restart a container with

/containers/15999301b96f/start
/containers/15999301b96f/stop
/containers/15999301b96f/restart

I get a 404 error with the message {"message":"page not found"}.

I'm using docker 1.12.1 and API 1.24.

Thank you in advance!

Upvotes: 1

Views: 2795

Answers (2)

jannis
jannis

Reputation: 5220

For the /containers/(id or name)/[start|stop|restart] endpoints you need to send POST requests instead of GET.

Reference:

Upvotes: 4

Tuan
Tuan

Reputation: 2363

From this guide, you will use GET request with

GET /containers/(id or name)/stats

But here, to start or stop, you will use POST request.

POST /containers/(id or name)/start
POST /containers/(id or name)/stop

Upvotes: 1

Related Questions