Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker Foundation (2)-- basic Operation

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Log in to your docker hub account with 1.Docker (the account you applied for on Docker hub is fine)

[root@www] # docker loginLogin with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.Username: * Password:WARNING! Your password will be stored unencrypted in / root/.docker/config.json.Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded

two。 Search for images in the mirror library

[root@www] # docker search nginxNAME DESCRIPTION STARS OFFICIAL AUTOMATEDnginx Official build of Nginx. 10250 [OK] jwilder/nginx-proxy Automated Nginx reverse proxy for docker con... 1462 [OK] richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of … [OK] jrcs/letsencrypt-nginx-proxy-companion LetsEncrypt container to use with nginx as p... [OK] kong Open-source Microservice & API Management la... [OK] webdevops/php-nginx Nginx with PHP-FPM 117 [OK] kitematic/hello-world-nginx A light-weight nginx container that demonstr... 112 zabbix/zabbix-web-nginx-mysql Zabbix frontend based on Nginx web-server wi... 75 [OK] bitnami/nginx Bitnami nginx Docker Image 58 [OK] 1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5 ubuntu-16-nginx-php-phpmyadmin-mysql-5 47 [OK] linuxserver/nginx An Nginx container Brought to you by LinuxS... 43 tobi312/rpi-nginx NGINX on Raspberry Pi / armhf 23 [OK] blacklabelops/nginx Dockerized Nginx Reverse Proxy Server. 12 [OK] nginx/nginx-ingress NGINX Ingress Controller for Kubernetes 12 wodby/drupal-nginx Nginx for Drupal container image 11 [OK] centos/nginx-18-centos7 Platform for running nginx 1.8 or building n... 8 nginxdemos/hello NGINX webserver that serves a simple page co... 8 [OK] centos/nginx-112-centos7 Platform for running nginx 1.12 or building... 5 1science/nginx Nginx Docker images that include Consul Temp... 4 [OK] travix/nginx NGinx reverse proxy 2 [OK] pebbletech/nginx-proxy nginx-proxy sets up a container running ngin... 2 [OK] mailu/nginx Mailu nginx frontend 2 [OK] toccoag/openshift-nginx Nginx reverse proxy for Nice running on same... 1 [OK] wodby/nginx Generic nginx 0 [OK] ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 0 [OK]

3.docker pulls the image that exists on docker hub to local (download the image on Docker hub)

[root@www ~] # docker pull httpd:2.4.37-alpine2.4.37-alpine: Pulling from library/httpd4fe2ade4980c: Already exists42101a4e4c4e: Pull complete73eadb9961ff: Pull complete830983fb5ec2: Pull complete78fb51bbfc27: Pull completeDigest: sha256:b875793145fe613aa2d1f73f1cd8ec09b775abcd6980024bc60a6a9c73d644fcStatus: Downloaded newer image for httpd:2.4.37-alpine [root@www ~] # docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEhttpd 2.4.37-alpine 11fc0c2a2dfa 4 days ago 91.8MBnginx 1.14-alpine 77bae8d00654 13 days ago 17.7MBljymyy/nginx latest 77bae8d00654 13 days ago 17.7MB

4. Make an image based on the container

[root@www] # docker container run-- name httpd1 httpd:2.4.37-alpineAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this messageAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message [Tue Nov 209mpm_event:notice] [pid 1:tid 140394175941512] AH00489: Apache/2.4.37 (Unix) configured-resuming normal operations [Tue Nov 20919195 2018] [core:notice] [pid 1:tid 140394175941512] AH00094: Command line: 'httpd-D FOREGROUND' [root@www ~] # docker exec-it httpd1 / bin/sh/usr/local/apache2 # / usr/local/apache2 # vi htdocs/index.html/usr/local/apache2 # exit [root@www ~] # docker commit httpd1 ljymyy/httpd:privatesha256:0c28c4522c128a7dca17c26d2fd8eee4e57642b455c067832d5567da1128da5e [root@www ~] # docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEljymyy/httpd private 0c28c4522c12 6 seconds ago 91.8MBhttpd 2.4.37-alpine 11fc0c2a2dfa 4 days ago 91.8MBnginx 1.14-alpine 77bae8d00654 13 days ago 17.7MBljymyy/nginx latest 77bae8d00654 13 days ago 17.7MB [root@www ~] # curl 172.17.0.2It works! Test successful

Test:

[root@www] # docker run-- name httpd2-- rm ljymyy/httpd:privateAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this messageAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message [Tue Nov 20 09 Tue Nov 39 Tue Nov 27 805890 2018] [mpm_event:notice] [pid 1:tid 140674896550792] AH00489: Apache/2.4.37 (Unix) configured-- resuming normal operations [Tue Nov 2009VV 39V 27.806444 2018] [core:notice] [pid 1:tid 140674896550792] AH00094: Command line: 'httpd-D FOREGROUND'172.17.0.1-- [20/Nov/2018:09:39:39 + 0000] "GET / HTTP/1.1" 20063 [root@www ~] # curl 172.17.0.3It works! Test successful

5. Tag the image; (IMAGE ID is the same)

[root@www ~] # docker tag ljymyy/httpd:private ljymyy/httpd:v2.0 [root@www ~] # docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEljymyy/httpd private 0c28c4522c12 5 minutes ago 91.8MBljymyy/httpd v2.0 0c28c4522c12 5 minutes ago 91.8MBhttpd 2 .4.37-alpine 11fc0c2a2dfa 4 days ago 91.8MBljymyy/nginx latest 77bae8d00654 13 days ago 17.7MBnginx 1.14-alpine 77bae8d00654 13 days ago 17.7MB

6. Upload the local image to the docker hub library

Create a personal Repository; in dashboard on docker hub to create the corresponding namespace and repository name; for example: ljymyy/httpd

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report