• 在Docker中体验数据库之Mongodb


      本文记录一下,在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

        以下是安装过程截图:

     

    0、sudo apt remove docker.io
    1、sudo apt-get install docker-ce
    2、docker
    3、sudo apt remove docker docker-engine docker.io
    4、sudo apt update
    5、sudo apt install 
        apt-transport-https 
        ca-certificates 
        curl 
        software-properties-common
    6、curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    7、sudo apt-key fingerprint 0EBFCD88
    8、sudo add-apt-repository 
       "deb [arch=amd64] https://download.docker.com/linux/ubuntu 
       $(lsb_release -cs) 
       stable"
    9、sudo apt update
    10、sudo apt install docker.io
    11、docker --help
    12、sudo docker info

      【2019-03-19更新】:更新安装docker过程中的命令

    0、sudo apt remove docker docker-engine docker.io containerd runc  
    1、sudo apt update
    2、sudo apt install 
        apt-transport-https 
        ca-certificates 
        curl 
        gnupg-agent 
        software-properties-common
    3、curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
        3.1、sudo apt-key fingerprint 0EBFCD88
    4、sudo add-apt-repository 
       "deb [arch=amd64] https://download.docker.com/linux/ubuntu 
       $(lsb_release -cs) 
       stable"
    5、sudo apt update
    6、sudo apt install docker-ce docker-ce-cli containerd.io
    7、docker --help
    8、sudo docker info

      二、非“sudo”使用docker

      安装完docker之后,你会发现使用docker需要sudo权限,可不可以去掉呢?当然没问题。

      用户组和用户相关操作参考:https://www.linuxidc.com/Linux/2016-09/135626.htm

    1、docker info
    2、cat /etc/group
    3、sudo groupadd docker  //如果不存在,创建docker用户组
    4、sudo gpasswd -a ${USER} docker 
    4.1、sudo gpasswd -dmyubuntu docker // 在用户中删除用户
    5、cat /etc/group
    6、systemctl restart docker
    7、docker info
    8、pkill x
    9、docker info

       三、安装mongodb

     

     

      mongodb的安装过程比较简单,比mysql简单多了,这里就不贴命令了,所以这篇文章才包含了其他的东西。到此结果。

  • 相关阅读:
    prometheus告警触发流程
    Mac 生成keystory文件
    web 登陆页面订做
    Gitlab 备份、恢复、平级迁移
    Gitlab 7.14.3 rpm 安装
    Mysql 启动方式
    Nginx 日志打印十六进制 x16x03x01x02x00x01x00x01xFCx03x03PxBB
    MacVim not work with perl 5.28
    Python 字符串前加u,r,b的含义
    免费 SSL 证书 certbot 配置
  • 原文地址:https://www.cnblogs.com/du-blog/p/9035538.html
Copyright © 2020-2023  润新知