Use Your Pod Imageยถ
Use the Pod image via Docker CLIยถ
The most powerful way to use this Pod image is via Docker CLI directly:
docker run --rm -p 55555:55555 -p 55556:55556 jinaai/hub.examples.mwu_encoder --port-in 55555 --port-out 55556
Note, the exposure of ports -p 55555:55555 -p 55556:55556
is required for other Pods (local/remote) to communicate this Pod. One may also want to use --network host
and let the Pod share the network layer of the host.
All parameters supported by jina pod --help
can be followed after docker run jinaai/hub.examples.mwu_encoder
.
One can mount a host path to the container via --volumes
or -v
. For example, to override the internal YAML config, one can do
# assuming $pwd is the root dir of this repo
docker run --rm -v $(pwd)/hub/example/mwu_encoder_ext.yml:/ext.yml jinaai/hub.examples.mwu_encoder --uses /ext.yml
[email protected] 1[S]:look at me! im from an external yaml!
[email protected] 1[S]:initialize MWUEncoder from a yaml config
[email protected] 1[I]:setting up sockets...
[email protected] 1[I]:input tcp://0.0.0.0:36109 (PULL_BIND) output tcp://0.0.0.0:58191 (PUSH_BIND) control over tcp://0.0.0.0:52365 (PAIR_BIND)
[email protected] 1[S]:ready and listening
To override the predefined entrypoint via --entrypoint
, e.g.
docker run --rm --entrypoint "jina" jinaai/hub.examples.mwu_encoder check
Use the Pod image via Jina CLIยถ
Another way to use the Pod image is simply give it to jina pod
via --uses
,
jina pod --uses jinaai/hub.examples.mwu_encoder
๐ณ [email protected] 1[S]:look at me! im from internal yaml!
๐ณ [email protected] 1[S]:initialize MWUEncoder from a yaml config
๐ณ [email protected] 1[I]:setting up sockets...
๐ณ [email protected] 1[I]:input tcp://0.0.0.0:59608 (PULL_BIND) output tcp://0.0.0.0:59609 (PUSH_BIND) control over tcp://0.0.0.0:59610 (PAIR_BIND)
[email protected][S]:ready and listening
๐ณ [email protected] 1[S]:ready and listening
Note the ๐ณ represents that the log is piping from a Docker container.
See jina pod --help
for more usage.
Use the Pod image via Flow APIยถ
Finally, one can use it via Flow API as well, e.g.
from jina.flow import Flow
f = (Flow()
.add(name='my-encoder', image='jinaai/hub.examples.mwu_encoder',
volumes='./abc', uses='hub/examples/mwu-encoder/mwu_encoder_ext.yml',
port_in=55555, port_out=55556)
.add(name='my-indexer', uses='indexer.yml'))