@mkvlr > No more spotify-docker? yes, this directly connects via the UNIX socket and does the HTTP calls 😄 as for the stdin attach, i will have to try it out a bit more and will get back asap. thanks for asking! im yet to test the multiplexed application/vnd.docker.raw-stream stuff better
@mkvlr it seems i need to implement some stuff for this. And how would you envision this api to be used? going by the way other http clients for example the official kubernetes client works, it opens up a websocket connection for attaching and uses the send and receive for stdout and stdin instead of the raw stream. I could implement a similar thing and let the callers use the outputstream mapped to the send of the websocket like https://github.com/kubernetes-client/java/blob/master/examples/src/main/java/io/kubernetes/client/examples/ExecExample.java
the other way of hijacking the unix socket directly can also be possible if i expose the raw socket like the py/go clients but you need to send raw bytes and read like wise. which imo seems to be not so clean?
this is the way python does it with hijacking raw sockets:
import docker
# connect to docker
client = docker.APIClient()
# create a container
container = docker_client.create_container(
'busybox',
stdin_open = True,
command = 'sh -c "cat - >/out"')
client.start(container)
# attach to the container stdin socket
s = client.attach_socket(container, params={'stdin': 1, 'stream': 1})
# send text
s.send('hello')
# close, stop and disconnect
s.close()
client.stop(container)
client.wait(container)
client.remove_container(container)
both using websockets and raw sockets would need a release from my side