When you request to one-off container,
you will receive a attach_url
. This page explains how to use this endpoint.
CONNECT [:attach_url]
To use this endpoint you have to hijack the HTTP connection. When a HTTP request is done, a TCP connection is created. HTTP hijacking consists in turning this connection into a full bidirectional connection.
HTTP is used to handle the routing and the headers. Then the raw TCP connection is used to exchange data.
PUT [:attach_url]
Send information to the container to update its state. As containers are
interactive and that most software you may be using are using libreadline
,
your should notify the container when the size of the terminal is changed for
instance.
width
: Width for the remote terminalheight
: Height for the remote terminalExample request:
curl -H 'Content-Type: application/json' -H 'Accept: application/json' \
-X PUT [:attach_url] -d \
'{
"width": 80,
"height": 25
}'
POST [:attach_url]/files
It may happen that you require a file to be present in your temporary container, for a batch or anything else, the transfer is done via a multipart form.
TheContent-Type
of this request is notapplication/json
, it should bemultipart/form-data; boundary=[:boundary]
It has to be done before attaching to the container. Files can be found in the directory /tmp/uploads
Form parameters:
file
: contain the name of the file and its content.Example request:
curl --form file=@mysql_dump.tar.gz [:attach_url]/files
Returns 200 OK Without content