Home > Back-end >  Installation in Ubuntu Docker file getting failed
Installation in Ubuntu Docker file getting failed

Time:12-02

I don't have any Ubuntu machines enabled with internet and I have requirement to have a docker image ready with some basic softwares enabled as this need to be configured as our Azuredevops build agent.

So in order to work my Dockerfile , I used one of aksnode itself to build my docker image as there I could see some of the apt-get commands working somehow (may be with default internet connectivity enabled there for aks functionalities).

Below is the source.list content of aks node and I tried to copy the same to my Ubuntu based Dockerfile

deb http://azure.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://azure.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic universe
deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://azure.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://azure.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://azure.archive.ubuntu.com/ubuntu/ bionic-security main restricted
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-security main restricted
deb http://azure.archive.ubuntu.com/ubuntu/ bionic-security universe
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-security universe
deb http://azure.archive.ubuntu.com/ubuntu/ bionic-security multiverse
# deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-security multiverse

After copying the same file to my Docker image build step as below.

COPY ./sources.list /etc/apt/

I could successfully install the basic software's like, curl wget, jq, git, python, etc...

But I am not able to install softwares like, AzureCLI, Docker, dockerce-and nodejs, chrome-headless, etc..

My dockerfile parts for them as below as below.

#4-Install AzureCLI
RUN curl -LsS https://aka.ms/InstallAzureCLIDeb | bash \
  && rm -rf /var/lib/apt/lists/*

#7-install node
RUN curl -sL https://deb.nodesource.com/setup_11.x  | bash -
RUN apt-get -y install nodejs
RUN npm install


#9-install docker daemon inside docker
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg |  gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo \
   "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update
RUN apt-get install docker-ce docker-ce-cli containerd.io -y

where all I am getting the error as below

curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to 

So looking for a way to get succeeded with all the above softwares installed without internet or do we have any azure archive repo for the same like other softwares enabled?

CodePudding user response:

Try this

# Add this before you install any thing
RUN apt clean && apt update && apt install ca-certificates

Try this

# Maybe try add parameter `--insecure` bypass ssl
curl --insecure https://xxxxxxx

Why add this in a container image ? Install a docker inn a container image ?

RUN apt-get install docker-ce docker-ce-cli containerd.io -y

CodePudding user response:

  1. I guess you want to build a docker image in a host only VM 1

  2. You don't want VM1 access internet

  3. In my experience, I will create a VM2 as Ubuntu Apt cache server.

4 VM1 will setup to point VM2, VM1 run any apt command will through VM2.

  1. VM 2 have 2 network interface, network 1 is NAT, network2 is host only.

(VM1 and VM2 in same network area (host only)

  1. search "How to Set up APT-Caching Server Using Apt-Cacher NG on Ubuntu 20.04"

CodePudding user response:

Another method to provide install deb is: In a Ubuntu machine, can access internet,

#9-install docker daemon inside docker

run:

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

run:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

run:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

run:

sudo apt-get update

run:

sudo apt clean

ls /var/cache/apt/archives/

sudo apt --download-only --assume-yes install docker-ce docker-ce-cli containerd.io docker-compose-plugin

run

$ ls /var/cache/apt/archives/
containerd.io_1.6.10-1_amd64.deb
docker-ce_5:20.10.21~3-0~ubuntu-jammy_amd64.deb
docker-ce-cli_5:20.10.21~3-0~ubuntu-jammy_amd64.deb
docker-ce-rootless-extras_5:20.10.21~3-0~ubuntu-jammy_amd64.deb
docker-compose-plugin_2.12.2~ubuntu-jammy_amd64.deb
docker-scan-plugin_0.21.0~ubuntu-jammy_amd64.deb
libslirp0_4.6.1-1build1_amd64.deb
pigz_2.6-1_amd64.deb
slirp4netns_1.0.1-2_amd64.deb

Now you can COPY /var/cache/apt/archives/*.deb TO Your VM1 (no internet0 and install deb files.

  • Related