Docker-从本地网络上的其他计算机访问

时间:2019-01-21 13:02:32

标签: docker

我有一个docker撰写文件,该文件设置了一个apache服务器。这样做的目的是为了在我的本地网络上进行开发。

一切正常,我可以在运行docker的PC上访问它。如果输入localhost:80,我将得到示例PHP索引文件。

我现在希望能够从本地网络上的其他计算机访问此文件。我一直在阅读文档,看来桥接网络是我应该关注的。

我在这个假设中正确吗?

我还希望将自签名证书添加到Apache服务器,以便我可以在本地网络上使用https,以便确保Bridge网络也可以这样做。

有人可以提供一些建议吗?

1 个答案:

答案 0 :(得分:1)

如果您不打算将容器拆分到多台主机上,则只需使用用户定义的桥接网络。 > results.09 Genetic Algorithm Feature Selection 150 samples 4 predictors 3 classes: 'setosa', 'versicolor', 'virginica' Maximum generations: 2 Population per generation: 20 Crossover probability: 0.8 Mutation probability: 0.1 Elitism: 0 Internal performance values: Accuracy, Kappa Subset selection driven to maximize internal Accuracy External performance values: Accuracy, Kappa Best iteration chose by maximizing external Accuracy External resampling method: Cross-Validated (5 fold) During resampling: * the top 4 selected variables (out of a possible 4): Petal.Width (80%), Petal.Length (40%), Sepal.Length (20%), Sepal.Width (20%) * on average, 1.6 variables were selected (min = 1, max = 4) In the final search using the entire training set: * 4 features selected at iteration 1 including: Sepal.Length, Sepal.Width, Petal.Length, Petal.Width * external performance at this iteration is Accuracy Kappa 0.9467 0.9200 为您创建默认网络后,您无需显式配置它。您所需要做的就是定义网络外部可用的tcp / udp端口并公开它们。

因此,您可以通过主机的机器ip地址/主机名看到所有公开的服务。

默认情况下,Docker将公开的端口绑定到所有可用接口,但是如果您需要仅在特定接口上提供服务,请使用以下语法:

docker-compose