Commit 85f289e1 authored by Vesa Vertainen's avatar Vesa Vertainen

updated private registry docker login, fixed port

parent 03f88c63
......@@ -35,7 +35,7 @@ services:
container_name: registry.cincan.io
hostname: registry.cincan.io
ports:
- 443:5000
- 5000:5000
volumes:
- '${REGISTRY}/data:/var/lib/registry'
- '${REGISTRY}/auth:/opt/cincan/auth'
......@@ -132,10 +132,3 @@ networks:
driver: default
config:
- subnet: 172.20.0.0/16
# environment:
# REGISTRY_HTTP_SECRET: verysecret
# REGISTRY_HTTP_TLS_CERTIFICATE: /opt/cincan/certs/registry.cincan.io.crt
# REGISTRY_HTTP_TLS_KEY: /opt/cincan/certs/registry.cincan.io.key
# REGISTRY_AUTH: htpasswd
# REGISTRY_AUTH_HTPASSWD_PATH: /opt/cincan/auth/htpasswd
# REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
......@@ -27,26 +27,34 @@ if [ ! "${UID}" -eq 0 ] ;then
fi
# Welcome banner
echo " _______ ______ "
echo " / ____(_)___ / ____/___ _____ "
echo " / / / / __ \/ / / __ \`/ __ \ "
echo "/ /___/ / / / / /___/ /_/ / / / / "
echo "\____/_/_/ /_/\____/\__,_/_/ /_/ "
echo ""
echo "Continuous Integration for the Collaborative Analysis of Incidents"
echo ""
echo "Private registry setup"
echo ""
# FUNCTIONS
# Ask for Docker username (because root is not necessarily the Docker user), cincan credentials, and login to private registry
# Get/ask for Docker username (because root is not necessarily the Docker user), cincan credentials, and login to registry
function getCredentials() {
echo -e "Type in your CinCan username [default: cincan]:"
read -r CINCAN_USERNAME
if [ "$CINCAN_USERNAME" = "" ]; then CINCAN_USERNAME="cincan";fi
echo -e "Type in your CinCan password:"
read -r PASSWORD
if [ "$PASSWORD" = "" ]; then
echo -e "Password not given"
exit 0
fi
echo -e "Type in your DOCKER username if not root [root]:"
read -r DOCKER_USERNAME
if [ "$DOCKER_USERNAME" = "" ]; then DOCKER_USERNAME="root";fi
# Get docker user's name
DOCKER_USERNAME=$(cat /etc/group |grep docker | awk '{print $1 }' RS=":" |tail -1)
sudo su "$DOCKER_USERNAME" -c "docker login -u $CINCAN_USERNAME -p $PASSWORD 172.20.0.6:5000" || { echo "Login failed"; exit 1; }
if [ ! $? -eq 0 ]; then
echo -e "Type in your DOCKER username if not root [root]:"
read -r DOCKER_USERNAME
if [ "$DOCKER_USERNAME" = "" ]; then DOCKER_USERNAME="root";fi
fi
echo "Login to private registry:"
sudo su "$DOCKER_USERNAME" -c "docker login 172.20.0.6:5000" || { echo "Login failed"; exit 1; }
}
......@@ -228,6 +236,7 @@ fi
pushImages
echo -e "\n\nTo fetch the list of images in the private registry, type:"
echo -e "\n\n$CHECK \e[32mPrivate registry is ready.\e[0m"
echo -e "\nTo get the list of images in the private registry, type:"
echo "curl -X GET https://<USERNAME>:<PASSWORD>@172.20.0.6:5000/v2/_catalog --insecure"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment