Open crooke opened 4 years ago
It seemed like it was the POST request to Docker that was hanging, then I realized I had extra braces in port_bindings, so I fixed that:
host_config = {
port_bindings: {
"8000/tcp": [{host_port: "8000"}],
},
}
However, then I get a compile-time error in crystal-docker:
In lib/docker/src/core_ext/hash/deep_transform_values.cr:30:7
30 | yield object
^---
Error: no overload matches 'Proc(Array(NamedTuple(HostPort: Int32)), Array(NamedTuple(HostPort: Int32)))#call' with type NamedTuple(HostPort: Int32)
Overloads are:
- Proc(T, R)#call(*args : *T)
If I change lib/docker/src/core_ext/hash/deep_transform_values.cr:30
to return the object directly instead of yield
ing, it compiles.
The JSON body doesn't get serialized to TitleCase the way I expected: {"HostConfig":{"port_bindings":{"8000/tcp":[{"host_port":8000}]}},"Image":"amazon/dynamodb-local"}
. But I can workaround that by just title-casing it myself:
host_config = {
"PortBindings": {
"8000/tcp": [{"HostPort": "8000"}],
},
}
I ran into the same error as you
Btw do you happen to know how I would get the output after running the container?
EDIT: I know there's log files stored with the output, but it would be easier if I could access output through the API EDIT: There doesn't seem to be any way to hijack it, like you can in fx. dockerode
I'm trying to create a container with host configuration:
But when I run
crystal run
on the file, it hangs indefinitely. I'm using docker-crystal commit: 898cea2884ea1305e49b7e52c5fa5d0553f843c2 with crystal 0.34.0.I may just be doing something wrong. Any help is appreciated. Thanks!