[英]Running customized mongo container in AWS EC2
I'm trying to running a cluster containing two containers, one with an image that runs a node.js
server, and one container for a mongo
db. 我正在尝试运行一个包含两个容器的群集,一个包含运行
node.js
服务器的映像,一个包含mongo
db的容器。
I'm following this tutorial , which states to use registry.hub.docker.com/library/mongo:latest
as the image url for the mongodb. 我正在按照本教程进行操作 , 该教程指出使用
registry.hub.docker.com/library/mongo:latest
作为mongodb的图像URL。
Now, I have a problem. 现在,我有一个问题。 Locally, when I run the mongo container on my pc, I use the following script , which does two things:
在本地,当我在PC上运行mongo容器时,我使用以下脚本 ,该脚本有两件事:
docker run
with a mongo
image, stating --replSet
in the arguments mongo
映像执行--replSet
docker run
,并在参数中声明--replSet
The hard part I can't wrap my head around, is the --replSet
part. 我无法缠住的
--replSet
部分是--replSet
部分。
When I run the container the the official mongodb
image, it initiates mongod
in some default way. 当我运行容器的官方
mongodb
映像时,它将以某种默认方式启动mongod
。
Say, I create a new Dockerfile
, which states FROM mongo:latest
. 说,我创建了一个新的
Dockerfile
,其状态为FROM mongo:latest
。
To my limited understanding, the rest of the things that will happen in the custom Dockerfile
, the mongod
is already ran. 据我有限的了解,其余的将在自定义
Dockerfile
发生, mongod
已经运行。 Is there any way I can modify that way it is executes in mongo:latest
, or modify an already active mongod
to allow the --replSet
option? 有什么办法可以修改它在
mongo:latest
执行的方式,还是修改一个已经处于活动状态的mongod
以允许--replSet
选项?
The shell commands on the mongo shell, as far as I understand, won't be a problem, since this is just a couple of RUN
commands in the Dockerfile
. 据我了解,mongo shell上的shell命令不会有问题,因为这只是
Dockerfile
的几个RUN
命令。
Thanks in advance for helping! 在此先感谢您的帮助!
我设法仅在ECS任务的网络模式设置为bridged
下运行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.