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

How to build a warehouse with docker-registry source code

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

Share

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

This article mainly explains "how to use docker-registry source code to build a warehouse", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use docker-registry source code to build a warehouse" bar!

Compile

[root@localhost docker-registry] # docker build-t "heidsoft-registry".

Sending build context to Docker daemon

FATA [0000] Post http:///var/run/docker.sock/v1.18/build?cgroupparent=&cpusetcpus=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=heidsoft-registry: dial unix / var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

[root@localhost docker-registry] # systemctl start dcoker

Failed to issue method call: Unit dcoker.service failed to load: No such file or directory.

[root@localhost docker-registry] # systemctl start docker

`

`

The image repository has been successfully built locally through source code, and has gone through a total of 12 steps:

@.... start

Building 'markupsafe._speedups' extension

X86_64-linux-gnu-gcc-pthread-fno-strict-aliasing-DNDEBUG-g-fwrapv-O2-Wall-Wstrict-prototypes-fPIC-I/usr/include/python2.7-c markupsafe/_speedups.c-o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o

X86_64-linux-gnu-gcc-pthread-shared-Wl,-O1-Wl,-Bsymbolic-functions-Wl,-Bsymbolic-functions-Wl,-z,relro-fno-strict-aliasing-DNDEBUG-g-fwrapv-O2-Wall-Wstrict-prototypes-D_FORTIFY_SOURCE=2-g-fstack-protector-- param=ssp-buffer-size=4-Wformat-Werror=format-security build/temp.linux-x86_64-2.7/markupsafe/_speedups.o-o build/lib.linux-x86_64-2.7/markupsafe/_speedups.so

Successfully installed docker-registry backports.lzma blinker Flask gevent gunicorn PyYAML requests M2Crypto sqlalchemy bugsnag Flask-cors newrelic Werkzeug Jinja2 itsdangerous greenlet webob markupsafe

Cleaning up...

-- > bb135fe1c419

Removing intermediate container 5561b2fef818

Step 8: RUN patch $(python-c 'import boto; import os; print os.path.dirname (boto.__file__)') / connection.py

< /docker-registry/contrib/boto_header_patch.diff --->

Running in bc90ae3350bb

Patching file / usr/local/lib/python2.7/dist-packages/boto/connection.py

-- > c4fc4bf464b2

Removing intermediate container bc90ae3350bb

Step 9: ENV DOCKER_REGISTRY_CONFIG / docker-registry/config/config_sample.yml

-- > Running in fc182d9daed0

-- > 9b16c0a3aaf8

Removing intermediate container fc182d9daed0

Step 10: ENV SETTINGS_FLAVOR dev

-- > Running in ebae054b90fb

-- > 1b4a1e134805

Removing intermediate container ebae054b90fb

Step 11: EXPOSE 5000

-- > Running in 648f41896bbf

-- > c3736b5cf3ab

Removing intermediate container 648f41896bbf

Step 12: CMD docker-registry

-- > Running in 3af3b4d0c90c

-- > 80aa76e58d06

Removing intermediate container 3af3b4d0c90c

Successfully built 80aa76e58d06

@... end

Run the compiled image

Docker run-d-- privileged-e SETTINGS_FLAVOR=dev-e STORAGE_PATH=/opt/registry-v / db/docker-images:/opt/registry-p 5000 STORAGE_PATH=/opt/registry 5000 heidsoft-registry

Join the authentication environment

Wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

Rpm-ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

Yum install nginx

Wget-c soft.vpser.net/lnmp/ext/htpasswd.sh

Create two logged in users

[root@heidsoft] #. / htpasswd.sh-c / etc/nginx/docker-registry.htpasswd heidsoft

= =

# A tool like htpasswd for Nginx #

#-#

# Author:Licess http://www.lnmp.org #

= =

Please input UserName:heidsoft

= =

UserName was: heidsoft

= =

Please input the Password:heidsoft

= =

Password was: heidsoft

= =

Please input Auth filename:heidsoft

= =

Auth File: / usr/local/nginx/conf/heidsoft

= =

[root@heidsoft] #. / htpasswd.sh-c / etc/nginx/docker-registry.htpasswd liubin

= =

# A tool like htpasswd for Nginx #

#-#

# Author:Licess http://www.lnmp.org #

= =

Please input UserName:liubin

= =

UserName was: liubin

= =

Please input the Password:liubin

= =

Password was: liubin

= =

Please input Auth filename:liubin

= =

Auth File: / usr/local/nginx/conf/liubin

= =

Press any key to Creat...or Press Ctrl+c to cancel

Create Auth file.

. / htpasswd.sh: line 64: / usr/local/nginx/conf/liubin.conf: No such file or directory

Create Auth file successful,auth file path:/usr/local/nginx/conf/liubin.conf.

[root@heidsoft ~] #

Nginx error log

`

Curl http://liubin:liubin@heidsoft.registry:8080/v1/search

2015-07-18 06:58:24 [crit] 35545: 0: * 1 connect () to 127.0.0.1 failed 5000 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.6, server: heidsoft.registry, request: "GET / v1/search HTTP/1.1", upstream: "http://127.0.0.1:5000/v1/search", host:" heidsoft.registry:8080 "

2015-07-18 06:58:24 [crit] 35545: * 1 connect () to [:: 1]: 5000 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.6, server: heidsoft.registry, request: "GET / v1/search HTTP/1.1", upstream: "http://[::1]:5000/v1/search", host:" heidsoft.registry:8080 "

`

After temporarily shutting down selinux, you can request to the

`

Setenforce 0

Thank you for reading, the above is the content of "how to use docker-registry source code to build a warehouse". After the study of this article, I believe you have a deeper understanding of how to use docker-registry source code to build a warehouse, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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