ubuntu 16.04版本安装docker以及创建docker容器

版权声明:使用请声明来源。 https://blog.csdn.net/frank_ldw/article/details/88839408

一 简介

Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

二,安装docker in ubuntu16.04

    • 首先更新资源update。

      sudo apt-get  update  

      ubuntu16.04安装使用docker的步骤

    • 安装docker。

      sudo apt-get install  docker

      ubuntu16.04安装使用docker的步骤

    • 安装docker.io。

      sudo   apt-get install   docker.io

      ubuntu16.04安装使用docker的步骤

    • 安装docker-registry。

      sudo apt-get install  docker-registry

      ubuntu16.04安装使用docker的步骤

    • 开始启动我们的docker

      sudo systemctl  start  docker

      ubuntu16.04安装使用docker的步骤

三 创建容器

         

  1. 用Docker的ubuntu镜像创建一个容器
docker run -d --name=testUbuntu ubuntu tail -f /dev/null
  1. 进入容器
docker exec -it testUbuntu bash
  1. 更新apt-get
apt-get update
  1. 安装需要的东西
#安装常用工具
apt-get install -y vim
apt-get install -y tree
apt-get install -y net-tools
#安装nginx
apt-get install -y nginx
#安装Python2
apt-get install -y python2.7
#安装Python3
apt-get install -y python3.7
#安装pip3
apt-get install python3-pip
#安装pip
apt-get install -y python-pip python-dev build-essential
#安装supervisor
apt-get install -y supervisor

#安装mysql
apt-get install -y mysql-server
apt-get install -y mysql-client
apt-get install -y libmysqlclient-dev
#检测mysql安装是否成功
netstat -tap | grep mysql
  1. 搭建项目环境
# 导出项目所用的模块
pip freeze >requirements.txt

# 安装导出项目所用的模块
pip install -r requirements.txt

猜你喜欢

转载自blog.csdn.net/frank_ldw/article/details/88839408