在Ubuntu 14中的Docker主机上启用远程API

时间:2016-05-07 06:11:25

标签: docker

我在Ubuntu 14.04上运行'Docker版本1.10.3,构建20f81dd'。现在我的要求是从外部世界的REST API(HTTP)创建/删除/管理新容器。因此,为此我如何启用Docker在端口上运行。

如果我在网上获得详细信息,我会尝试很少但不起作用会有所帮助。

1 个答案:

答案 0 :(得分:3)

我找到了解决方案,这很容易。这是配置。

得到:

DOCKER_OPTS="-H tcp://127.0.0.1:2375"

添加netstat -lnp

重启docker service。

运行#include <stdio.h> #include <ctype.h> #define BASEPAY1 8.75 // $8.75/hr #define BASEPAY2 9.33 // $9.33/hr #define BASEPAY3 10.00 // $10.00/hr #define BASEPAY4 11.20 // $11.20/h2 #define BASEHRS 40 // basepay #define OVERTIME 1.5 // 1.5 time #define AMT1 300 // 1st rate tier #define AMT2 150 // 2st rate tier #define RATE1 0.15 // rate for 1st tier #define RATE2 0.20 // rate for 2nd tier #define RATE3 0.25 // rate for 3rd tier int main(void) { double hours; double gross; double net; double taxes; double pay; int response; double total; double num; printf_s("************************************************\n"); printf_s("Pick number from 1-4 based on salary:\n"); printf_s("\n1) $8.75/hr\n"); printf_s("\n2) $9.33/hr\n"); printf_s("\n3) $10.00/hr\n"); printf_s("\n4) $11.20/hr\n"); printf_s("\n5) quit\n"); printf_s("************************************************\n"); scanf_s("%d", &response); while (scanf_s("%d", &response) == 1 && response != 5) { if (response > 4) { printf("enter a valid number please\n"); continue; } switch (response) { case 1: pay = BASEPAY1; break; case 2: pay = BASEPAY2; break; case 3: pay = BASEPAY3; break; case 4: pay = BASEPAY4; break; case 5: return 0; default: break; printf("Enter the number of hours: \n"); scanf_s("%d", &hours); total = hours * pay; printf("your gross pay this week is: %d", total); } } } ,看看docker正在2375端口上运行