在Docker中体验数据库之Mongodb
2024-08-26 10:42:02
本文记录一下,在docker中安装Mongodb的过程。
环境:物理机 ubuntu18.04
因为环境变了,我在一台物理机上直接安装了ubuntu(非虚拟机和双系统),制作U盘镜像、安装参考:https://ywnz.com/linuxaz/1438.html,所以这次又参照在docker中初次体验.net core 2.0安装了一遍docker,但是进行的不是很顺利。执行命令:sudo apt-get install docker-ce 时会报错,安装docker时不再使用“docker-ce”而是“docker.io”,ubuntu建议使用apt而非apt-get。至于两者的区别,参考:https://www.sysgeek.cn/apt-vs-apt-get/ 。
一、在Ubuntu 18.04中安装docker
以下是安装过程截图:
、sudo apt remove docker.io
、sudo apt-get install docker-ce
、docker
、sudo apt remove docker docker-engine docker.io
、sudo apt update
、sudo apt install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
、curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
、sudo apt-key fingerprint 0EBFCD88
、sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
、sudo apt update
、sudo apt install docker.io
、docker --help
、sudo docker info
【2019-03-19更新】:更新安装docker过程中的命令
、sudo apt remove docker docker-engine docker.io containerd runc
、sudo apt update
、sudo apt install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
、curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3.1、sudo apt-key fingerprint 0EBFCD88
、sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
、sudo apt update
、sudo apt install docker-ce docker-ce-cli containerd.io
、docker --help
、sudo docker info
二、非“sudo”使用docker
安装完docker之后,你会发现使用docker需要sudo权限,可不可以去掉呢?当然没问题。
用户组和用户相关操作参考:https://www.linuxidc.com/Linux/2016-09/135626.htm
、docker info
、cat /etc/group
、sudo groupadd docker //如果不存在,创建docker用户组
、sudo gpasswd -a ${USER} docker
4.1、sudo gpasswd -dmyubuntu docker // 在用户中删除用户
、cat /etc/group
、systemctl restart docker
、docker info
、pkill x
、docker info
三、安装mongodb
mongodb的安装过程比较简单,比mysql简单多了,这里就不贴命令了,所以这篇文章才包含了其他的东西。到此结果。
最新文章
- If you really want to compile without asm, configure with --disable-asm.
- GIT在iOS开发中的使用
- WooCommerce微信支付插件免费版下载
- SQL的内连接与外连接
- 总结1-JMeter压力测试
- .jar是什么文件?(转载)
- C# 面向对象基础&;封装&;继承&;多态&;加深一下冒泡排序写法
- Tcpdump安装使用
- Django 2.0 学习(03):Django视图和URL(下)
- Powershell的IIS管理小结
- redis哨兵架构的基础知识及部署和管理
- GZip、deflate和sdch压缩(网摘整理)
- SV coverage
- MVC 5 Scaffolder + EntityFramework+UnitOfWork Pattern 代码生成工具集成Visual Studio 2013
- Bacterial Melee CodeForces - 756D (dp去重)
- Hash(MD5校验工具)
- Effect
- D. Monitor Educational Codeforces Round 28
- java动态代码的实现以及Class的卸载 (转至http://dustin.iteye.com/blog/46393)
- js通过生成临时表单再删除的方式向后台提交数据(模拟ajax的post提交但还要跳转页面不返回数据)以及 struts向前台返回文件下载及防止中文乱码处理