安装docker(不会安装可参考https://blog.csdn.net/github_34457546/article/details/84754644)之后下载镜像
使用docker最简单的方式莫过于从现有的容器镜像开始。Docker官方网站专门有一个页面来存储所有可用的镜像,网址是:index.docker.io。你可以通过浏览这个网页来查找你想要使用的镜像,或者使用命令行的工具来检索。
命令:docker search tutorial
[root@VM_0_5_centos ~]# docker search tutorial
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
learn/tutorial 40
georgeyord/reactjs-tutorial This is the backend of the React comment b... 5 [OK]
microsoft/aci-tutorial-app 2
fiware/tutorials.tourguide-app FIWARE Tour Guide App sample application 1 [OK]
mhausenblas/kairosdb-tutorial GitHub fetcher for KairosDB tutorial 1 [OK]
microsoft/aci-tutorial-sidecar 1
muli/gluon-tutorials-zh https://github.com/mli/gluon-tutorials-zh 1 [OK]
chris24walsh/flask-aws-tutorial Runs a simple flask webapp demo, with the ... 1 [OK]
starkandwayne/concourse-tutorial 0
activeeon/par-connector-tutorial Do the par-connector tutorial with R. The ... 0 [OK]
fgraichen/concourse-tutorial-hello-world 0
camphor/python-tutorial camphor-/python-tutorial 0 [OK]
等等
可以选择learn/tutorial进行下载:docker pull learn/tutorial
下载后测试
在docker容器中运行hello world!
docker容器可以理解为在沙盒中运行的进程。这个沙盒包含了该进程运行所必须的资源,包括文件系统、系统类库、shell 环境等等。但这个沙盒默认是不会运行任何程序的。你需要在沙盒中运行一个进程来启动某一个容器。这个进程是该容器的唯一进程,所以当该进程结束的时候,容器也会完全的停止。
docker run learn/tutorial echo "hello word"
[root@VM_0_5_centos ~]# docker run learn/tutorial echo "hello word"
hello word
测试成功!