Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

curl examples for link command #227

Closed
vnugent opened this issue Jul 6, 2014 · 1 comment
Closed

curl examples for link command #227

vnugent opened this issue Jul 6, 2014 · 1 comment

Comments

@vnugent
Copy link
Contributor

vnugent commented Jul 6, 2014

I'm looking for container linking examples using curl

curl -X POST http://10.16.23.108:43273/containers/links -d { not sure what to do }

@wallrj
Copy link
Contributor

wallrj commented Jul 7, 2014

Here's where @smarterclayton explains the format:

Here's where @smarterclayton explains that links can't currently be modified via the REST API

Here's a corresponding feature request #223

And here's an example showing how to add links at unit creation time which I posted to the mailing list:

$ curl -v -X PUT "http://127.0.0.1:43273/container/my-sample-service";
-H "Content-Type: application/json" -d '{"Started": true,
"NetworkLinks": [{"ToPort": 44831, "FromPort": 31337, "FromHost":
"127.0.0.1", "ToHost": "127.0.0.1"}], "Image":
"openshift/busybox-http-app", "Ports": []}'

* upload completely sent off: 173 out of 173 bytes
< HTTP/1.1 204 No Content

$ sudo gear list-units
ID                SERVER  ACTIVE  SUB     LOAD    TYPE
my-sample-service         active  running loaded

]$ sudo gear status my-sample-service
ctr-my-sample-service.service - Container my-sample-service
   Loaded: loaded
(/var/lib/containers/units/my/ctr-my-sample-service.service; enabled)
   Active: active (running) since Mon 2014-06-30 18:04:14 BST; 2min 13s ago
 Main PID: 13337 (docker)
   CGroup: /container.slice/container-small.slice/ctr-my-sample-service.service
           └─13337 /usr/bin/docker run --rm --name my-sample-service
--volumes-from my-sample-service-data -a stdout -a stderr
openshift/busybox-http-app

Jun 30 18:04:13 localhost.localdomain sh[13320]: Reusing <no value>
Jun 30 18:04:13 localhost.localdomain docker[13330]: Error: No such
container: my-sample-service
Jun 30 18:04:13 localhost.localdomain docker[13330]: 2014/06/30
18:04:13 Error: failed to remove one or more containers
Jun 30 18:04:13 localhost.localdomain gear[13338]: user: unknown user
ctr-my-sample-service
Jun 30 18:04:14 localhost.localdomain docker[13337]: Serving
/usr/mock/source/ on port 8080...
Jun 30 18:04:14 localhost.localdomain gear[13338]: Updating network
namespaces for 13385
Jun 30 18:04:14 localhost.localdomain gear[13338]: Using 10.0.2.15/24
for 127.0.0.1
Jun 30 18:04:14 localhost.localdomain gear[13338]: Mapping
172.17.0.87(127.0.0.1):31337 -> 10.0.2.15:44831
Jun 30 18:04:14 localhost.localdomain systemd[1]: Started Container
my-sample-service.
Jun 30 18:04:34 localhost.localdomain systemd[1]: Started Container
my-sample-service.

Hope that helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants