小知识:Docker安装和简单使用入门教程

安装

由于我本人使用的linux系统,原生支持docker,相对安装还是比较简单的

1:使用下面的官方脚本安装:

?
1
wget -qO- https://get.docker.com/ | sh

2:输入下面的命令验证是否可以查看版本号,可以就是安装成功

?
1
sudo docker version

3:建议把当前使用的用户加到Docker用户组,就可以不用很次都sudo

?
1
sudo usermod -aG docker your_username

4:重新登录,sudo权限才会成效

logout

至此,你的docker环境就已经很快的安装完了

简单使用

一切从hello world开始,如下命令

?
1
docker run hello-world

你大致会看到如下内容

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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/

现在就开始开始自己的docker学习之旅吧!

以上所述是小编给大家介绍的Docker安装和简单使用入门教程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

声明: 猿站网有关资源均来自网络搜集与网友提供,任何涉及商业盈利目的的均不得使用,否则产生的一切后果将由您自己承担! 本平台资源仅供个人学习交流、测试使用 所有内容请在下载后24小时内删除,制止非法恶意传播,不对任何下载或转载者造成的危害负任何法律责任!也请大家支持、购置正版! 。本站一律禁止以任何方式发布或转载任何违法的相关信息访客发现请向站长举报,会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。本网站的资源部分来源于网络,如有侵权烦请发送邮件至:2697268773@qq.com进行处理。
建站知识

小知识:使用Grafana 展示Docker容器的监控图表并设置邮件报警规则(图解)

2023-4-19 15:06:39

建站知识

小知识:通过提前bake Docker镜像加快基础设施的启动速度

2023-4-19 15:21:27

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索