linux下安装与运行docker

写者环境:

1.lsb_release -a

[email protected]:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial

2.更新apt和安装gpg秘钥

2.1 sudo apt-get update

2.2 sudo apt-get install apt-transport-https ca-certificates

2.3 sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

3.编辑源文件

sudo vi /etc/apt/source.list.d/docker.list (此文件不存在就直接创建即可)

将文件中的所有内容都删掉,然后写入内容入下:

deb https://apt.dockerproject.org/repo ubuntu-xenial main

4.更新apt包索引

sudo apt-get update

5.安装docker

sudo apt-get install docker-engine

6.启动docker

sudo service docker start

7.验证docker是否正在运行

sudo docker run hello-world

写者运行结果如下:

[email protected]:~$ sudo docker run hello-world
Unable to find image ‘hello-world:latest‘ locally
latest: Pulling from library/hello-world
b04784fba78d: Pull complete
Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f
Status: Downloaded newer image for hello-world:latest

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 ID:
https://cloud.docker.com/

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

8.将当前用户加入到docker组

sudo usermod -a -G docker hello

9.重启docker

sudo service docker restart

时间: 2024-08-29 12:29:19

linux下安装与运行docker的相关文章

Linux下安装Java运行环境

趁着双12的优惠,在百度云入手了一台新的服务器.安装了CentOS 7.6的系统.网上找了许多安装JAVA环境的教程,但是都不是很全,于是只能自己动手,整合一篇出来.我的方法是纯服务器上面操作,没有用到拷贝软件上去的安装方法.为了满足比较常用的环境,我在操作系统上面安装了JDK8,Mysql5.7,Tomcat8.5这些软件. 准备工作安装目录 我们创建如下路径/usr/develop,然后在develop目录下面创建java,tomcat和mysql三个目录即可. 可以看到相应目录下已经新增成

linux下安装和运行wireshark

一.安装 以root用户运行:yum install wireshark 二.运行 在终端中键入命令: #wireshark bash:wireshark:command not found #whereis wireshark wireshark: /usr/lib/wireshark /usr/share/wireshark #cd /usr/lib/wireshark #ls plugins #cd /usr/share/wireshark; ls AUTHORS-SHORT  dtds 

linux下安装jre运行环境

上官网下载安装文件:点击打开链接 文件名:jre-8u65-linux-x64.gz安装步骤1.解压tar -xzvf jre-8u65-linux-x64.gz2.将解压后的文件放到/usr/lib/java 3.接下来需要使用vim或gedit来修改/etc/environment配置文件,在这个文件中增加如下的环境变量:JAVA_HOME="/usr/lib/java/jre1.8.0_65"CLASSPATH="$JAVA_HOME/lib"PATH=&qu

在linux下安装eclipse以及运行c++程序的安装步骤

1.       下载jre,eclipse,cdt 其中jre是java运行环境,eclipse需要先装jre,才可能运行,cdt是在eclipse中运行c\c++程序的插件. 下载jre 网址是:http://www.oracle.com/technetwork/java/javase/downloads/index.html,点击JRE下载(如下图) 选择"Aceept License Argeement" (如上图) 点击"jre-7u21-linux-i586.bi

linux下安装codeblocks及写完程序之后编译成功但无法运行的原因

一:在软件中心输入codeblocks,然后点击安装,等着装完就行了. 再按ctrl+alt+t 打开终端 输入 sudo apt-get install gcc 而后再输入sudo apt-get install g++ 最后打开codeblocks写个 helloworld 试试吧. 二:helloworld小程序写完后,也编译通过了,但是却无法运行,那么你再看看保存的地方吧,要是不是保存在linux下的文档了,而是保存在磁盘里的话就是造成不能运行的结果了,更改保存位置试试看呗. 以上仅是我

Docker折腾手记-linux下安装

Docker折腾手记-linux下安装 Linux下的安装方法 博主用的是centos7,其它也是大同小异 我根据的是官网的教程进行的操作,地址是 https://docs.docker.com/engine/installation/linux/centos/#install-using-the-repository 刚开始他们balabala了一大堆,要注意的就是在x64的centos才可以安装docker 官方提供了两种方式一种是使用存儲库进行安装 ,一种是从包中进行安装 ,两种方式都可以

随笔记:Linux下安装Python

下载Python 在官网上下载安装包,目前地址为:https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz 得到Python-2.7.9.tgz 解压 将Python-2.7.9.tgz解压到当前目录下 tar zxvf ./Python-2.7.9.tgz -C ./ 安装 切换到根目录,开始安装 sudo ./configure sudo make sudo make install 测试 测试下有木有安装成功,如顺利,能看到以下日志

linux下安装QQ

下载地址:WineQQ2013SP6-20140102-Longene 以下步骤一定要按照顺序来,我用的系统是 安装QQ sudo -i cd /etc/apt/sources.list.d echo "deb http://archive.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list apt-get update apt-get install ia32

linux 下安装 jdk tomcat 并配置

linux下安装TOMCAT与JDK 第1步:新建boss用户,用户名:boss,密码:boss 第2步:将安装用户路径设置成/app/boss [[email protected]]# useradd-d /app/boss -m boss [[email protected]]# passwdboss Changing password for user boss. New password:  boss passwd: all authentication tokens updated s