A standalone alternative to hub.docker.com?

I would like to create a personal version of hub.docker.com that would allow me to create a web host clicked by my personal gitlab instance. In other words - when I click Gitlab, this Docker registry checks the repository and builds it.

I need this to be resistant to malicious Docker files so that the server cannot be easily hacked by showing the contents of all hosted containers. Is there a way that I could easily achieve this?

+5
source share
2 answers

You need to configure the registry and the build server separately. Thus, when you click GitLab, it notifies the build system (via POST) and creates an image. After the assembly is completed, the final image enters the registry (on its own or on hub.docker.com).

Registry setting

  • First, make sure you have docker installed.
  • Then run the following command, which will start the registry instance.

    sudo docker run --restart='always' -d -p 5000:5000 --name=registry \
    -e GUNICORN_OPTS=["--preload"] \
    -v /srv/registry:/tmp/registry \
    registry
    
  • To open the web interface for the specified registry, follow these steps: (Replace the registry IP address)

    sudo docker run  -d -P --restart='always' \
    -e ENV_DOCKER_REGISTRY_HOST=<REGISTRY_IP> \
    -e ENV_DOCKER_REGISTRY_PORT=5000 \
    konradkleine/docker-registry-frontend
    

Build Server Configuration

  • A comprehensive Jenkins build server can fill this gap.
  • GitLab CI ( Jenkins), API CI GitLab. , CI " Jenkins" → " ". , . - .


    enter image description here
  • GitLab CI PUSH ServicesGitLab CI.
    : GitLab v7.7.2. AFAIK, GitLab, GitLab CI.


    enter image description here
  • jenkins . Build on Push Events.


    Gitlab ci push
  • script. , docker . . https://docs.docker.com/registry/insecure/

    # Build and push image
    cd $WORKSPACE
    docker build -t <REGISTRY_IP>:5000/<PROJECT_NAME>:latest .
    docker push <REGISTRY_IP>:5000/<PROJECT_NAME>:latest
    

tarzan. , GitHub ( GitLab). , , .

, tarzan GitHub, GitLab.

+5

GitLab Enterprise Edition Docker ( 2015 ). https://docs.gitlab.com/ee/user/project/container_registry.html

0

Source: https://habr.com/ru/post/1619258/


All Articles