User Tools

Site Tools


технология_docker

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
технология_docker [2022/06/30 09:15]
val [Запуск в режиме демона и подключение к контейнеру]
технология_docker [2022/07/15 12:19] (current)
val [Репозиторий]
Line 140: Line 140:
 /​etc/​init.d/​inetutils-inetd start /​etc/​init.d/​inetutils-inetd start
  
 +touch /​var/​log/​webd.log
 +#chown 10003 /var/www/
 +  ​
 if [ "​$MYMODE"​ = '​TEST'​ ]; then if [ "​$MYMODE"​ = '​TEST'​ ]; then
   bash      # not work in k8s   bash      # not work in k8s
 else else
-  tail -/​var/​log/​webd.log+  tail -/​var/​log/​webd.log
 fi fi
 </​code><​code>​ </​code><​code>​
Line 155: Line 158:
 COPY start.sh / COPY start.sh /
 COPY webd /​usr/​local/​sbin/​webd COPY webd /​usr/​local/​sbin/​webd
-### ADD www.tgz /var/     ​#for simple test in k8s+### ADD www.tgz /var/          #for simple ​test in k8s 
 +###COPY index.html /​var/​www/ ​  #test in k8s
  
 EXPOSE 80 EXPOSE 80
Line 258: Line 262:
   webd:   webd:
     image: test/webd     image: test/webd
 +#    image: server.corp13.un:​5000/​student/​webd:​1.1
     build: webd/     build: webd/
     ports:     ports:
       - "​8000:​80"​       - "​8000:​80"​
 +#      - "​80"​
     volumes:     volumes:
       - /​var/​www/:/​var/​www/​       - /​var/​www/:/​var/​www/​
 +#      - vol1:/​var/​www/​
 +
 +#    environment:​
 +#      - MYMODE=TEST
 +#    stdin_open: true
     tty: true     tty: true
   sftp:   sftp:
Line 270: Line 281:
     volumes:     volumes:
       - /​var/​www/:/​home/​user3/​www       - /​var/​www/:/​home/​user3/​www
 +#      - vol1:/​home/​user3/​www
     command: user3:​password3:​10003     command: user3:​password3:​10003
 +#volumes:
 +#  vol1:
 </​code><​code>​ </​code><​code>​
 # docker-compose build # docker-compose build
Line 282: Line 296:
 # docker-compose down # docker-compose down
  
-# docker-compose rm    #​Возможно,​ не требуется +# docker-compose rm
-</​code>​ +
-===== Дополнительные материалы ===== +
- +
-==== Локальный репозиторий ==== +
- +
- * [[https://​docs.docker.com/​registry/​|Docker Registry]]+
  
-<​code>​ +# docker ​volume rm root_vol1
-gate# docker ​run -d -p 5000:5000 -v /​root:/​certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/​certs/​gate.crt -e REGISTRY_HTTP_TLS_KEY=/​certs/​gate.key --name registry registry:​2 +
- +
-node1# cp ~vagrant/​gate.crt /​etc/​docker/​certs.d/​gate.corp13.un\:​5000/​ca.crt +
- +
-node1# service docker restart +
- +
-node1# docker tag val/​webd:​latest gate.corp13.un:​5000/​webd +
- +
-node1# docker push gate.corp13.un:​5000/​webd +
- +
-node1# curl --insecure -X GET https://​gate.corp13.un:​5000/​v2/​_catalog +
-{"​repositories":​["​webd"​]}+
 </​code>​ </​code>​
  
-==== GitLab ​репозиторий ====+===== Локальные ​репозитории ===== 
 + 
 +==== Insecure Private Registry ​====
  
   * [[Инструмент GitLab#​GitLab Docker Registry]]   * [[Инструмент GitLab#​GitLab Docker Registry]]
 +  * [[https://​docs.docker.com/​registry/​insecure/​|Test an insecure registry/​Deploy a plain HTTP registry]]
  
 <​code>​ <​code>​
Line 322: Line 321:
 # docker login http://​server.corpX.un:​5000 # docker login http://​server.corpX.un:​5000
  
 +# less ~/​.docker/​config.json
 +</​code><​code>​
 +{
 +        "​auths":​ {
 +                "​server.corp13.un:​5000":​ {
 +                        "​auth":​ "​c3R1ZGVudDpwYXNzd29yZA=="​
 +                }
 +        }
 +}
 +</​code><​code>​
 # docker tag test/webd server.corpX.un:​5000/​student/​webd # docker tag test/webd server.corpX.un:​5000/​student/​webd
 # docker tag test/webd server.corpX.un:​5000/​student/​webd:​wwwdir # docker tag test/webd server.corpX.un:​5000/​student/​webd:​wwwdir
Line 328: Line 337:
 # docker push server.corpX.un:​5000/​student/​webd:​wwwdir # docker push server.corpX.un:​5000/​student/​webd:​wwwdir
 ... ...
-# docker run --name webd01 --hostname webd01 -itd -p 8000:80 server.corp13.un:​5000/​student/​webd:​wwwdir+# docker run --name webd01 --hostname webd01 -itd --rm -p 8000:80 server.corpX.un:​5000/​student/​webd 
 +</​code>​ 
 + 
 +==== Использование образа Docker Registry ==== 
 + 
 +  * [[https://​docs.docker.com/​registry/​|Docker Registry]] 
 + 
 +<​code>​ 
 +gate# docker run -d -p 5000:5000 -v /​root:/​certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/​certs/​gate.crt -e REGISTRY_HTTP_TLS_KEY=/​certs/​gate.key --name registry registry:​2 
 + 
 +node1# cp ~vagrant/​gate.crt /​etc/​docker/​certs.d/​gate.corp13.un\:​5000/​ca.crt 
 + 
 +node1# service docker restart 
 + 
 +node1# docker tag val/​webd:​latest gate.corp13.un:​5000/​webd 
 + 
 +node1# docker push gate.corp13.un:​5000/​webd 
 + 
 +node1# curl --insecure -X GET https://​gate.corp13.un:​5000/​v2/​_catalog 
 +{"​repositories":​["​webd"​]}
 </​code>​ </​code>​
  
технология_docker.1656569744.txt.gz · Last modified: 2022/06/30 09:15 by val