当前位置: 首页 > news >正文

LinuxMint下Docker的安装部署和验证

通过lsb_release命令查看以下我的LinuxMint发行版,

查看以下我的Linux内核版本,

 

Docker要求Linux内核版本必须在要在3.10以上,显然我们的系统是满足的。

1. Docker安装

操作系统默认的apt源有docker包,我们可以直接使用下面的apt-get命令安装docker

$ sudo apt-get install -y docker.io

不过其安装的版本比较老。我们采用下面两种方式进行安装,个人比较推荐第二种,第二种方式安装的是最新的。

1.1 Dockerapt源安装

参考网页https://get.docker.com/ubuntu/内容进行安装,为方便直接将内容复制如下,

 # Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
    apt-get update
    apt-get install -y apt-transport-https
fi

# Add the repository to your APT sources
echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list

# Then import the repository key
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

# Install docker
apt-get update
apt-get install -y lxc-docker

目前从Dockerapt源安装的docker版本是1.7.1

1.2 curl安装

网站https://get.docker.com提供了curl-able的安装脚本install.sh,我们可以通过curl的方式进行安装docker。我们先安装curl

$ sudo apt-get update
$ sudo apt-get install curl

然后运行下面命令安装docker

 $ curl -k -sSl https://get.docker.com | sudo sh

该方式安装的docker版本是1.8.3,如下所示,

 

2. Docker验证

Docker安装结束后,我们来验证以下docker的功能。官方的Docker Hub提供了hello-world的镜像,我们可以通过该镜像起一个容器来验证我们已正确安装了docker

lienhua34@lienhua34-Compaq-Presario-CQ35-Notebook-PC ~ $ sudo docker run hello-world

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

出现上面打印信息表示,docker已正常工作。

3. 后记

有了docker之后,我们如果验证某些linux下的功能,而有不希望污染到我们的主机环境。那么我们就可以起一个linux环境的容器,然后在里面进行操作。操作结束后,就直接将容器杀掉即可。安全、方便、快捷!

例如下面启动一个Ubuntu 14.04的容器,并直接进入该容器,然后我们就可以在该容器里随便进行操作了。

$ sudo docker run -ti --name myubuntu ubuntu:14.04

 

(done)

 

**版本声明:该博文为博主原创,如需转载,请事先征求博主同意。

相关文章:

  • Vue-cli / webpack 加载静态js文件的方法
  • python函数的动态传参.作用域与命名空间
  • static DEVICE_ATTR(val, S_IRUGO | S_IWUSR, hello_val_show, hello_val_store); 的作用
  • 几分钟内提升技能的8个 JavaScript 方法!
  • HTTP请求中的form data和request payload的区别
  • Linux内核-协议栈-从BSD Socket接口层到传输层1
  • centos7全离线安装MongoDB3.2.8集群
  • Java基础学习18(类的多态性以及子父类之间的转换机制)
  • Python的三种基本数据类型
  • 窗体数据Excle导入功能详解
  • Linux -LAMP架构介绍
  • 2018-2019-1 20165226 20165310 20165315 实验二 固件程序设计
  • html5本地存储
  • SQL Join 图示
  • P117、面试题18:树的子结构
  • 【Leetcode】104. 二叉树的最大深度
  • 10个最佳ES6特性 ES7与ES8的特性
  • Docker 1.12实践:Docker Service、Stack与分布式应用捆绑包
  • JS创建对象模式及其对象原型链探究(一):Object模式
  • js面向对象
  • Logstash 参考指南(目录)
  • python学习笔记 - ThreadLocal
  • RxJS: 简单入门
  • webpack+react项目初体验——记录我的webpack环境配置
  • 从 Android Sample ApiDemos 中学习 android.animation API 的用法
  • 配置 PM2 实现代码自动发布
  • 微信小程序填坑清单
  • 一加3T解锁OEM、刷入TWRP、第三方ROM以及ROOT
  • MPAndroidChart 教程:Y轴 YAxis
  • #### go map 底层结构 ####
  • #QT(TCP网络编程-服务端)
  • %@ page import=%的用法
  • (aiohttp-asyncio-FFmpeg-Docker-SRS)实现异步摄像头转码服务器
  • (LeetCode) T14. Longest Common Prefix
  • (附源码)ssm基于web技术的医务志愿者管理系统 毕业设计 100910
  • (十八)三元表达式和列表解析
  • (转)setTimeout 和 setInterval 的区别
  • .NET 事件模型教程(二)
  • .NET8.0 AOT 经验分享 FreeSql/FreeRedis/FreeScheduler 均已通过测试
  • .net对接阿里云CSB服务
  • /dev/VolGroup00/LogVol00:unexpected inconsistency;run fsck manually
  • @Conditional注解详解
  • [2016.7.Test1] T1 三进制异或
  • [2019.3.20]BZOJ4573 [Zjoi2016]大森林
  • [C/C++随笔] char与unsigned char区别
  • [C++] Boost智能指针——boost::scoped_ptr(使用及原理分析)
  • [C++基础]-入门知识
  • [HXPCTF 2021]includer‘s revenge
  • [Latex学习笔记]数学公式基本命令
  • [mysql]错误解决之Failed to start MySQL Server
  • [OS-Linux] CentOS 7.x 使用密钥登录安全设置
  • [Paper]Cardiologist-Level Arrhythmia Detection with Convolutional Neural Networks
  • [Python]面向对象基础
  • [RK3568][Android11]内核Oops日志分析
  • [Ruby]变量替换