Reputation: 1479
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?
Upvotes: 1
Views: 10259
Reputation: 3009
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%3a20.10.21~3-0~ubuntu-jammy_amd64.deb
docker-ce-cli_5%3a20.10.21~3-0~ubuntu-jammy_amd64.deb
docker-ce-rootless-extras_5%3a20.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.
2022/12/05 update
#Internet Host:
mkdir -p ~/WK/data
cd ~/WK
docker run -it -v ~/WK/data:/data ubuntu:20.04 /bin/bash
do all steps in docker containers
cp /var/cache/apt/archives/*.deb /data/
cp /etc/apt/keyrings/docker.gpg /data/
cp /etc/apt/sources.list.d/docker.list /data/
# exit docker
exit
copy ~/WK/data to INTRANET MACHINE ~/WK/data
cd ~/WK
docker run -it -v ~/WK/data:/data ubuntu:20.04 /bin/bash
# do all docker install step
# if error is xxx , find xxx.deb is in /data folder
# try to install xxx.deb
dpkg -i xxx.deb
Upvotes: 2
Reputation: 3009
solution 3: use apt-offline
You need two machines, one connected (VM-INTERNET), one offline (VM-HOSTONLY), both machines need to install apt-offline.
If you want to execute apt update
.
You have to perform the following steps:
VM-HOSTONLY$ sudo apt-offline set --update update-VM-HOSTONLY.sig
VM-INTERNET$ apt-offline get update-VM-HOSTONLY.sig --threads 5 --bundle update-VM-HOSTONLY.zip
VM-HOSTONLY$ sudo apt-offline install update-VM-HOSTONLY.zip
If you want to execute apt-get upgrade
You have to perform the following steps:
VM-HOSTONLY$ sudo apt-offline set --upgrade upgrade-VM-HOSTONLY.sig
VM-INTERNET$ apt-offline get upgrade-VM-HOSTONLY.sig --threads 5 --bundle upgrade-VM-HOSTONLY.zip
VM-HOSTONLY$ sudo apt-offline install upgrade-VM-HOSTONLY.zip
VM-HOSTONLY$ sudo apt-get upgrade
If you want to execute apt-get install
You have to perform the following steps:
VM-HOSTONLY$ sudo apt-offline set install-VM-HOSTONLY-apache2.sig --install-packages apache2 libapache2-mod-php
VM-INTERNET$ apt-offline get install-VM-HOSTONLY-apache2.sig --threads 5 --bundle install-VM-HOSTONLY-apache2.zip
VM-HOSTONLY$ sudo apt-offline install install-VM-HOSTONLY-apache2.zip
VM-HOSTONLY$ sudo apt-get install apache2 libapache2-mod-php
Please note that VM-HOSTONLY$ indicates that this instruction is executed on a VM-HOSTONLY machine; VM-INTERNET$ indicates that this instruction is executed on a VM-INTERNET machine.
The result file generated by the execution process, such as xxx.sig , or xxx.zip needs to be copied to the corresponding machine by yourself. But at least it can package multiple related deb files into a zip for easy copying and delivery.
It is recommended that you test all the required files in the VM environment first, and then prepare these zip files for docker.
Upvotes: 1
Reputation: 3009
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
Upvotes: 1