Docker基础(2)——基础操作

发布时间:2024-04-19 点击:87
云计算
1.docker登入docker hub账号,(docker hub上申请的账号即可)
[root@www~]#dockerloginloginwithyourdockeridtopushandpullimagesfromdockerhub.ifyoudon'thaveadockerid,headovertohttps://hub.docker.comtocreateone.warning!yourpasswordwillbestoredunencryptedin/root/.docker/config.json.configureacredentialhelpertoremovethiswarning.seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeloginsucceeded2.搜索镜像库中的镜像;
[root@www~]#dockersearchnginxnamedescriptionstarsofficialautomatednginxofficialbuildofnginx.10250[ok]jwilder/nginx-proxyautomatednginxreverseproxyfordockercon…1462[ok]richarvey/nginx-php-fpmcontainerrunningnginx php-fpmcapableof…647[ok]jrcs/letsencrypt-nginx-proxy-companionletsencryptcontainertousewithnginxasp…438[ok]kongopen-sourcemicroservice&apimanagementla…247[ok]webdevops/php-nginxnginxwithphp-fpm117[ok]kitematic/hello-world-nginxalight-weightnginxcontainerthatdemonstr…112zabbix/zabbix-web-nginx-mysqlzabbixfrontendbasedonnginxweb-serverwi…75[ok]bitnami/nginxbitnaminginxdockerimage58[ok]1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5ubuntu-16-nginx-php-phpmyadmin-mysql-547[ok]linuxserver/nginxannginxcontainer,broughttoyoubylinuxs…43tobi312/rpi-nginxnginxonraspberrypi/armhf23[ok]blacklabelops/nginxdockerizednginxreverseproxyserver.12[ok]nginx/nginx-ingressnginxingresscontrollerforkubernetes12wodby/drupal-nginxnginxfordrupalcontainerimage11[ok]centos/nginx-18-centos7platformforrunningnginx1.8orbuildingn…8nginxdemos/hellonginxwebserverthatservesasimplepageco…8[ok]centos/nginx-112-centos7platformforrunningnginx1.12orbuilding…51science/nginxnginxdockerimagesthatincludeconsultemp…4[ok]travix/nginxnginxreverseproxy2[ok]pebbletech/nginx-proxynginx-proxysetsupacontainerrunningngin…2[ok]mailu/nginxmailunginxfrontend2[ok]toccoag/openshift-nginxnginxreverseproxyfornicerunningonsame…1[ok]wodby/nginxgenericnginx0[ok]ansibleplaybookbundle/nginx-apbanapbtodeploynginx0[ok]3.docker拉取存在docker hub上的镜像至本地(下载docker hub上的镜像);
[root@www~]#dockerpullhttpd:2.4.37-alpine2.4.37-alpine:pullingfromlibrary/httpd4fe2ade4980c:alreadyexists42101a4e4c4e:pullcomplete73eadb9961ff:pullcomplete830983fb5ec2:pullcomplete78fb51bbfc27:pullcompletedigest:sha256:b875793145fe613aa2d1f73f1cd8ec09b775abcd6980024bc60a6a9c73d644fcstatus:downloadednewerimageforhttpd:2.4.37-alpine[root@www~]#dockerimagelsrepositorytagimageidcreatedsizehttpd2.4.37-alpine11fc0c2a2dfa4daysago91.8mbnginx1.14-alpine77bae8d0065413daysago17.7mbljymyy/nginxlatest77bae8d0065413daysago17.7mb4.基于容器制作镜像
[root@www~]#dockercontainerrun--namehttpd1httpd:2.4.37-alpineah00558:httpd:couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using172.17.0.2.setthe'servername'directivegloballytosuppressthismessageah00558:httpd:couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using172.17.0.2.setthe'servername'directivegloballytosuppressthismessage[tuenov2009:19:04.7101552018][mpm_event:notice][pid1:tid140394175941512]ah00489:apache/2.4.37(unix)configured--resumingnormaloperations[tuenov2009:19:04.7191952018][core:notice][pid1:tid140394175941512]ah00094:commandline:'httpd-dforeground'[root@www~]#dockerexec-ithttpd1/bin/sh/usr/local/apache2#/usr/local/apache2#vihtdocs/index.html/usr/local/apache2#exit[root@www~]#dockercommithttpd1ljymyy/httpd:privatesha256:0c28c4522c128a7dca17c26d2fd8eee4e57642b455c067832d5567da1128da5e[root@www~]#dockerimagelsrepositorytagimageidcreatedsizeljymyy/httpdprivate0c28c4522c126secondsago91.8mbhttpd2.4.37-alpine11fc0c2a2dfa4daysago91.8mbnginx1.14-alpine77bae8d0065413daysago17.7mbljymyy/nginxlatest77bae8d0065413daysago17.7mb[root@www~]#curl172.17.0.2<html><body><h2>itworks!</h2></body></html>testsuccessful
测试:
[root@www~]#dockerrun--namehttpd2--rmljymyy/httpd:privateah00558:httpd:couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using172.17.0.3.setthe'servername'directivegloballytosuppressthismessageah00558:httpd:couldnotreliably

赶双十一入手个阿里云服务器
19阿里云双十一云服务器打折
腾讯云服务器部署jsp网站
网站导航设计怎么才是符合搜索引擎优化?SEO网站导航建设技巧分享
租来的阿里云服务器里面都有什么
电脑通过创建ws2_32.dll文件禁止使用应用程序的方法
小程序定制开发要注意哪些?
电脑插上显卡开不了机怎么办_电脑插上显卡开不了机的处理方法