Docker create命令具有什么功能呢?
下文笔者讲述Docker中create命令的功能简介说明,如下所示
docker create功能: 创建一个新容器,但是不启动容器
docker create命令语法
docker create [OPTIONS] IMAGE [COMMAND] [ARG...] 注意事项 docker create的语法同docker run相同例: docker create命令的示例分享
[root@node0 ~]# docker create --name=nginx -p 80:80 nginx d53a0d94a99da9745cac48bc3ef08b555cbd0e4a58126c349cbfc0f1c35e2253 [root@node0 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NA MESd53a0d94a99d nginx "/docker-entrypoin..." 4 seconds ago Created ng inxa836837b1f12 centos "/usr/bin/top -b" 31 minutes ago Exited (0) 24 minutes ago ce ntostest[root@node0 ~]# docker start d53 d53 [root@node0 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d53a0d94a99d nginx "/docker-entrypoin..." 9 seconds ago Up 1 second 0.0.0.0:80->80/tcp nginx [root@node0 ~]# curl http://localhost <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> html { color-scheme: light dark; } body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。