Nexus:Docker: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(16 intermediate revisions by the same user not shown)
Line 86: Line 86:
docker push reg.chorke.org/academia-http-server:1.0.0
docker push reg.chorke.org/academia-http-server:1.0.0
</source>
</source>
==Networking==
<source lang="json">
cat <<EOF > /etc/docker/daemon.json
{
    "registry-mirrors": ["https://hub.chorke.org"],
    "bip"  : "10.20.13.1/24",
    "mtu"  : 1500,
    "dns"  : [
        "10.19.83.100",
        "10.19.83.1"
    ],
    "debug": true
}
EOF
</source>
==Cache or Mirror==
<source lang="properties">
mkdir -p /etc/docker/registry
cat <<EOF > /etc/docker/registry/config.yml
proxy:
  remoteurl: https://hub.chorke.org
  username: academia
  password: sadaqah!
EOF
</source>
==Troubleshoot==
{|
| valign="top" |
<source lang="bash">
docker run --rm --net=host busybox nslookup google.com
docker run --rm --net=host alpine cat /etc/resolv.conf
docker run --rm --net=host alpine nslookup google.com
docker run --rm --net=host alpine ping google.com
docker run --rm --net=host alpine cat /etc/hosts
docker run --rm --net=host alpine ifconfig
docker run --rm --net=host alpine ip addr
docker run --rm --net=host alpine route
</source>
| valign="top" |
<source lang="bash">
docker run --rm busybox nslookup google.com
docker run --rm alpine cat /etc/resolv.conf
docker run --rm alpine nslookup google.com
docker run --rm alpine ping google.com
docker run --rm alpine cat /etc/hosts
docker run --rm alpine ifconfig
docker run --rm alpine ip addr
docker run --rm alpine route
</source>
|}
----
{|
| valign="top" |
───────────────────────────────────────
cat /etc/docker/registry/config.yml
cat /etc/docker/daemon.json
cat ~/.docker/config.json
docker info
| valign="top" |
docker run --rm hub.chorke.org/alpine cat /etc/resolv.conf
docker run --rm hub.chorke.org/alpine nslookup google.com
docker run --rm hub.chorke.org/alpine ping google.com
docker run --rm hub.chorke.org/alpine cat /etc/hosts
docker run --rm hub.chorke.org/alpine ip addr
|}
==Knowledge==
'''docker push and pull'''
docker login reg.chorke.org -u academia -p sadaqah!
docker tag chorke/crawler:1.0.00 reg.chorke.org/chorke/crawler:1.0.00
docker push reg.chorke.org/chorke/crawler:1.0.00
docker login hub.chorke.org -u academia -p sadaqah!
docker pull hub.chorke.org/chorke/crawler:1.0.00
docker \
run --detach \
--name crawler \
--publish 1983:1983  \
hub.chorke.org/chorke/crawler:1.0.00
docker exec -it crawler /bin/sh


==References==
==References==
* [https://docs.docker.com/registry/recipes/mirror/#run-a-registry-as-a-pull-through-cache Run a Registry as a pull-through Cache]
* [https://blog.sonatype.com/using-nexus-3-as-your-repository-part-3-docker-images Configure Nexus Docker Registry]
* [https://blog.sonatype.com/using-nexus-3-as-your-repository-part-3-docker-images Configure Nexus Docker Registry]
* [https://stackoverflow.com/questions/59634926 No Basic Auth Credentials]
* [https://stackoverflow.com/questions/59634926 No Basic Auth Credentials]
* [https://help.sonatype.com/repomanager3/formats/docker-registry Nexus Docker Registry]
* [https://help.sonatype.com/repomanager3/formats/docker-registry Nexus Docker Registry]
* [[Nexus]]
* [[Nexus]]

Latest revision as of 06:12, 2 February 2021

Recipe Types:
──────────────────────────────────────────
nexus/repository/recipe/types
─┬────────────────────────────────────────
 ├─ group
 ├─ proxy
 └─ host
Repositories:
──────────────────────────────────────────
https://cdn.chorke.org/nexus/repository/
─┬────────────────────────────────────────
 ├─ docker-registry/   [proxy]
 ├─ docker-private/    [host ]
 └─ docker-group/      [group]

Blob Store

Admin   : https://cdn.chorke.org/nexus/#admin/repository/blobstores
Path    : /nexus-data/blobs/docker-registry
Name    : docker-registry
Admin   : https://cdn.chorke.org/nexus/#admin/repository/blobstores
Path    : /nexus-data/blobs/docker-private
Name    : docker-private
Admin   : https://cdn.chorke.org/nexus/#admin/repository/blobstores
Path    : /nexus-data/blobs/docker-group
Name    : docker-group

Repository

Admin   : https://cdn.chorke.org/nexus/#admin/repository/repositories
HTTP    : 8083
V1 API  : enable
Deploy  : Allow redeploy
Storage : docker-private
Name    : docker-private
Admin   : https://cdn.chorke.org/nexus/#admin/repository/repositories
USE HUB : enable
proxy   : https://registry-1.docker.io
Storage : docker-registry
Name    : docker-registry
Admin   : https://cdn.chorke.org/nexus/#admin/repository/repositories
HTTP    : 8082
Members : docker-private, docker-registry
Storage : docker-group
Name    : docker

Security

vim /etc/docker/daemon.json

{
  "insecure-registries": [
    "hub.chorke.org:8082",
    "reg.chorke.org:8083"
  ],
  "disable-legacy-registry": true
}

vim ~/.docker/config.json

{
  "auths": {
    "hub.chorke.org:8082": {
      "auth": "YWNhZGVtaWE6c2FkYXFhaCE="
    },
    "reg.chorke.org:8083": {
      "auth": "YWNhZGVtaWE6c2FkYXFhaCE="
    }
}

docker login  hub.chorke.org -u academia -p sadaqah!
docker login  hub.chorke.org -u academia
docker logout hub.chorke.org

docker pull hub.chorke.org/httpd:2.4-alpine
docker tag academia-http-server:1.0.0 reg.chorke.org/academia-http-server:1.0.0
docker push reg.chorke.org/academia-http-server:1.0.0

Networking

cat <<EOF > /etc/docker/daemon.json
{
    "registry-mirrors": ["https://hub.chorke.org"],
    "bip"  : "10.20.13.1/24",
    "mtu"  : 1500,
    "dns"  : [
        "10.19.83.100",
        "10.19.83.1"
    ],
    "debug": true
}
EOF

Cache or Mirror

mkdir -p /etc/docker/registry
cat <<EOF > /etc/docker/registry/config.yml
proxy:
  remoteurl: https://hub.chorke.org
  username: academia
  password: sadaqah!
EOF

Troubleshoot

docker run --rm --net=host busybox nslookup google.com
docker run --rm --net=host alpine cat /etc/resolv.conf
docker run --rm --net=host alpine nslookup google.com
docker run --rm --net=host alpine ping google.com
docker run --rm --net=host alpine cat /etc/hosts
docker run --rm --net=host alpine ifconfig
docker run --rm --net=host alpine ip addr
docker run --rm --net=host alpine route
docker run --rm busybox nslookup google.com
docker run --rm alpine cat /etc/resolv.conf
docker run --rm alpine nslookup google.com
docker run --rm alpine ping google.com
docker run --rm alpine cat /etc/hosts
docker run --rm alpine ifconfig
docker run --rm alpine ip addr
docker run --rm alpine route

───────────────────────────────────────
cat /etc/docker/registry/config.yml
cat /etc/docker/daemon.json
cat ~/.docker/config.json
docker info
docker run --rm hub.chorke.org/alpine cat /etc/resolv.conf
docker run --rm hub.chorke.org/alpine nslookup google.com
docker run --rm hub.chorke.org/alpine ping google.com
docker run --rm hub.chorke.org/alpine cat /etc/hosts
docker run --rm hub.chorke.org/alpine ip addr

Knowledge

docker push and pull
docker login reg.chorke.org -u academia -p sadaqah!
docker tag chorke/crawler:1.0.00 reg.chorke.org/chorke/crawler:1.0.00
docker push reg.chorke.org/chorke/crawler:1.0.00

docker login hub.chorke.org -u academia -p sadaqah!
docker pull hub.chorke.org/chorke/crawler:1.0.00
docker \
run --detach \
--name crawler \
--publish 1983:1983  \
hub.chorke.org/chorke/crawler:1.0.00
docker exec -it crawler /bin/sh

References