v5captain
sudo docker search nginx

 

这么多镜像应该选择哪一个?

一般选择Description中Official的,其次STARS人最多的,最后看名称和Description符合自己需求的。

有了镜像那么如何使用呢?

可以打开管网https://hub.docker.com/,搜索镜像名称nginx,点击打开搜索到的nginx能看到详细的镜像介绍。

简单示例:

mkdir ~/www/html

echo "Hello nginx" >~/www/html/index.html

sudo docker run --name my-nginx -v ~/www/html:/usr/share/nginx/html -p 8080:80 -d nginx

http://localhost:8080/

 更多用法https://hub.docker.com/_/nginx

查看创建的镜像:

sudo docker ps -a

进入镜像(b7f是容器id):

sudo docker exec -it b7f /bin/bash

分类:

技术点:

相关文章:

  • 2021-12-12
  • 2022-01-14
  • 2021-06-30
  • 2021-12-31
  • 2022-01-16
  • 2022-01-22
  • 2022-01-23
  • 2022-12-23
猜你喜欢
  • 2021-09-29
  • 2021-12-06
  • 2021-08-29
  • 2021-12-08
  • 2021-11-28
相关资源
相似解决方案