A
A
Anton Charov2021-03-31 15:49:23
Oracle
Anton Charov, 2021-03-31 15:49:23

How to install a certificate for downloading a docker image?

I'm trying to make an image with Oracle Weblogic.

FROM store/oracle/weblogic:12.2.1.4When you run the script, it says that you need authorization to download.

[+] Building 8.8s (4/4) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.2s
 => => transferring dockerfile: 38B                                                                                0.1s
 => [internal] load .dockerignore                                                                                  0.6s
 => => transferring context: 2B                                                                                    0.1s
 => ERROR [internal] load metadata for docker.io/store/oracle/weblogic:12.2.1.4                                    7.9s
 => [auth] store/oracle/weblogic:pull token for registry-1.docker.io                                               0.0s
------
 > [internal] load metadata for docker.io/store/oracle/weblogic:12.2.1.4:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch oauth token: Get https://auth.docker.io/token?scope=repository%3Astore%2Foracle%2Fweblogic%3Apull&service=registry.docker.io: x509: certificate signed by unknown authority

Dockerfile
# LICENSE UPL 1.0
#
# Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This Dockerfile extends the Oracle WebLogic image by creating a sample domain.
#
# The 'base-domain' created here has Java EE 7 APIs enabled by default:
#  - JAX-RS 2.0 shared lib deployed
#  - JPA 2.1,
#  - WebSockets and JSON-P
#
# Util scripts are copied into the image enabling users to plug NodeManager
# magically into the AdminServer running on another container as a Machine.
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
#      $ sudo docker build -t 1213-domain --build-arg ADMIN_PASSWORD=welcome1 .
#

# Pull base image
# ---------------
FROM container-registry.oracle.com/middleware/weblogic

# WLS Configuration
# -------------------------------
ARG ADMIN_PASSWORD
ARG PRODUCTION_MODE

ENV DOMAIN_NAME="base_domain" \
    PRE_DOMAIN_HOME=/u01/oracle/user_projects \
    ADMIN_PORT="7001" \
    ADMIN_HOST="wlsadmin" \
    NM_PORT="5556" \
    MS_PORT="7002" \
    CONFIG_JVM_ARGS="-Dweblogic.security.SSL.ignoreHostnameVerification=true" \
    PATH=$PATH:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:$PRE_DOMAIN_HOME/domains/base_domain:$PRE_DOMAIN_HOME/domains/base_domain/bin:/u01/oracle

# Add files required to build this image
COPY scripts/* /u01/oracle/

# Configuration of WLS Domain
USER root
WORKDIR /u01/oracle
RUN /u01/oracle/wlst /u01/oracle/create-wls-domain.py && \
    mkdir -p $PRE_DOMAIN_HOME && \
    chmod a+xr $PRE_DOMAIN_HOME && \
    chown -R oracle:oracle $PRE_DOMAIN_HOME && \
    mkdir -p $PRE_DOMAIN_HOME/domains/base_domain/servers/AdminServer/security && \
    echo "username=weblogic" > $PRE_DOMAIN_HOME/domains/base_domain/servers/AdminServer/security/boot.properties && \
    echo "password=$ADMIN_PASSWORD" >> $PRE_DOMAIN_HOME/domains/base_domain/servers/AdminServer/security/boot.properties && \
    echo ". $PRE_DOMAIN_HOME/domains/base_domain/bin/setDomainEnv.sh" >> /u01/oracle/.bashrc && \
    echo "export PATH=$PATH:/u01/oracle/wlserver/common/bin:$PRE_DOMAIN_HOME/domains/base_domain/bin" >> /u01/oracle/.bashrc && \
    cp /u01/oracle/commEnv.sh /u01/oracle/wlserver/common/bin/commEnv.sh && \
    rm /u01/oracle/create-wls-domain.py /u01/oracle/jaxrs2-template.jar

# Expose Node Manager default port, and also default http/https ports for admin console
EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT

USER oracle
WORKDIR $PRE_DOMAIN_HOME/domains/base_domain

# Define default command to start bash.
CMD ["/u01/oracle/user_projects/domains/base_domain/startWebLogic.sh"]

How to install a certificate?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Charov, 2021-04-02
@pvpered

Adding the insecure-registry key with the host name helped. Self-signed certificates or adding to daemon.json did not affect the situation in any way.

docker build --insecure-registry container-registry.oracle.com --build-arg ADMIN_PASSWORD=$1  -t 1213-domain .

D
Dmitry, 2021-03-31
@q2digger

and I have an indiscreet question - is your Dockerfile not written with a small letter by any chance?

A
Andrey Barbolin, 2021-03-31
@dronmaxman

x509: certificate signed
by unknown authority it is signed by a certificate authority unknown to it. On your PC, you need to install the CA that signed auth.docker.io.
On ubuntu you can do this
https://www.techrepublic.com/article/how-to-instal...
Alpine
https://support.circleci.com/hc/en-us/articles/360...
Install CA
https://forums.docker.com/t/docker-private-registr...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question