如何在码头箱容器里启动一个mongodb shell? [英] How to start a mongodb shell in docker container?

查看:108
本文介绍了如何在码头箱容器里启动一个mongodb shell?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要启动容器,我输入以下命令:

To start the container, I am typing the following command:

sudo docker run -i -t -p 28000:27017 mongo:latest /usr/bin/mongod --smallfiles

但是我想打开shell这个容器键入mongo命令。
我应该运行什么命令来执行相同的操作?

But I want to open the shell in this container to type the mongo commands. What command should I run to do the same?

推荐答案

这是另一种方法:打开一个新的终端/ p>

This is an alternate way: Open a new terminal

mongo 127.0.0.1:28000

您的mongo shell现在在此终端启动。

Your mongo shell starts in this terminal now.

这篇关于如何在码头箱容器里启动一个mongodb shell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆