Docker container connection timeout while installing packages - docker

I'm having some trouble installing some packages.
The command is:
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libkrb5-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
The error is:
E: Failed to fetch http://deb.debian.org/debian/pool/main/k/krb5/libkadm5clnt-mit12_1.18.3-6%2bdeb11u1_amd64.deb 502 Connection timed out [IP: 146.75.62.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ERROR: Service 'webserver' failed to build: The command '/bin/sh -c apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libkrb5-dev && apt-get clean && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
The connection works well and I'm able to install other packages.
This morning I was also able to build the same image correctly but suddenly it started to give me that error. Always with the same package.
Yesterday I had the same problem with other packages, but I managed to solve them by splitting the installation into different rows.
I'm having this problem with different packages every now and then and I'm 100% sure that is not a connection problem. If I add more packages before it always fails on the same package.
I tried to ping the IP from another container and it works. I also tried to open the link to download the file and everything works fine.
I always build it with the --no-cache option.
This is the complete Dockerfile
FROM php:7.4-apache-bullseye as php
# PhpUnit 8 (Version 9 doesn' support php 7.2)
# Install phpunit, the tool that we will use for testing
RUN curl --location --output /usr/local/bin/phpunit "https://phar.phpunit.de/phpunit-9.phar" && chmod +x /usr/local/bin/phpunit
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -yqq --no-install-recommends zip && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends sqlite3 && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libpng-dev libcurl4-openssl-dev libxml2-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --fix-missing --no-install-recommends libc-client-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --fix-missing --no-install-recommends libldap2-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libcap2-bin && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libldb-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends memcached libmemcached-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y zlib1g-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure mysql && docker-php-ext-install mysql \
&& docker-php-ext-configure gd && docker-php-ext-install gd \
&& docker-php-ext-configure curl && docker-php-ext-install curl \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap \
&& docker-php-ext-configure xml && docker-php-ext-install xml \
&& docker-php-ext-configure soap && docker-php-ext-install soap \
&& docker-php-ext-configure bcmath && docker-php-ext-install bcmath \
&& docker-php-ext-configure intl && docker-php-ext-install intl \
&& docker-php-ext-configure ldap && docker-php-ext-install ldap
RUN pecl install igbinary && docker-php-ext-enable igbinary
RUN pecl install -o -f redis && docker-php-ext-enable redis
RUN pecl install -o -f msgpack && docker-php-ext-enable msgpack
RUN pecl install -o -f memcached && docker-php-ext-enable memcached
RUN pecl install -o -f pcov && docker-php-ext-enable pcov
RUN pecl install -o -f xdebug && docker-php-ext-enable xdebug
Thank you in advance for you help

Related

Issue compiling Dockerfile on MacOS(apple Sillicon)

This is my first time to use Docker
I build a Dockerfile and use the Vscode remote container to open folder in Container.
When I run this Dockerfile on Windows 11. It does not have any problem
But When I run it on MacOS(apple Sillicon). It have error.
after I step by step to check the Dockerfile.
I find that if I install g++multilib or libc6-dev-i386, it will get error.
I do not have any idea about why?
Dockerfile:
FROM ubuntu:18.04
RUN apt update \
&& apt-get -y install gcc g++ python \
&& apt-get -y install python-dev \
&& apt-get -y install qt4-dev-tools libqt4-dev \
&& apt-get -y install mercurial \
&& apt-get -y install bzr \
&& apt-get -y install cmake libc6-dev \
&& apt-get -y install gdb valgrind \
&& apt-get -y install flex bison libfl-dev \
&& apt-get -y install tcpdump \
&& apt-get -y install sqlite sqlite3 libsqlite3-dev \
&& apt-get -y install gsl-bin libgslcblas0 \
&& apt-get -y install libxml2 libxml2-dev \
&& apt-get -y install libgtk2.0-0 libgtk2.0-dev \
&& apt-get -y install vtun lxc \
&& apt -y install git \
&& apt -y install npm \
&& apt-get -y install g++-multilib libc6-dev-i386
devcontainer.json:
{
"name": "802.11ah ns-3 simulation",
"dockerFile": "Dockerfile",
"appPort": 3000,
"extensions": ["dbaeumer.vscode-eslint"],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
}
}
error information: https://i.stack.imgur.com/ZE04I.jpg
You dont have specified the architetture of Ubuntu container in docker file. Apple silicon have ARM architecture, not all image are compatibile.

Docker: /usr/bin/python: can't find '__main__' module in '.'

Below is my docker file
FROM ubuntu:latest
COPY requirements.txt .
RUN apt-get update -y && apt-get install -y telnet unixodbc-dev ksh curl apt-utils apt-transport-https debconf-utils gcc build-essential python2.7.x python-dev build-essential && curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py && python get-pip.py && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && curl https://packages.microsoft.com/config/ubuntu/21.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql17 && ACCEPT_EULA=Y apt-get install -y mssql-tools && /bin/bash -c 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc && /bin/bash -c "source ~/.bashrc" && pip install -r requirements.txt && apt-get -y clean && rm -rf /var/lib/apt/lists/*
Entrypoint ["python"]
Below is my requirements.txt
pyodbc==4.0.30
I am getting the below error:
Cause: found extra "." caused the issue.
Solution: docker run -t getting-started

Undetermined error (109) in docker apt-get for ros-pcl

I am trying to get some ros packages in docker. I have a command like:
RUN apt-get update && cat /srv/hm_ros.system | xargs apt-get install -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/* && apt-get clean
where hm_ros.system is a file containing:
python3-rosinstall
ros-noetic-fkie-multimaster
ros-noetic-mavlink
ros-noetic-pcl-ros
ros-noetic-robot-state-publisher
ros-noetic-ros-base
ros-noetic-rosbridge-suite
ros-noetic-rosserial
ros-noetic-tf
ros-noetic-unique-id
ros-noetic-urdf
ros-noetic-xacro
But i always get the error:
E: Failed to fetch http://packages.ros.org/ros/ubuntu/po... Undetermined Error [IP: 64.50.236.52 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The other packages seem to be found succsessfully. A note, prior to this I have:
RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends lsb-release gnupg2 && \
DEBIAN_FRONTEND="noninteractive" apt-get -y --no-install-recommends install tzdata \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN add-apt-repository universe && add-apt-repository multiverse
RUN echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/ros-latest.list && \
apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
Of further interest, if I install it stand-alone, ie.:
RUN apt-get update && apt-get install -y --no-install-recommends ros-noetic-pcl-ros && \
rm -rf /var/lib/apt/lists/* && apt-get clean
Then this problem does not occur, and even though there are almost 1gb of dependencies.
Any ideas why this can occur?
Although I still do not know the cause of this, it can be solved by using the following install command:
sudo apt-get \
-o Acquire::BrokenProxy="true" \
-o Acquire::http::No-Cache="true" \
-o Acquire::http::Pipeline-Depth="0" \
install -y \
package ...

Dockerfile Installing Selenium - Ambiguous code

Can someone explain this code to me?
# Installation required for selenium
RUN apt-get update -y \
&& apt-get install --no-install-recommends --no-install-suggests -y tzdata ca-certificates bzip2 curl wget libc-dev libxt6 \
&& apt-get install --no-install-recommends --no-install-suggests -y `apt-cache depends firefox-esr | awk '/Depends:/{print$2}'` \
&& update-ca-certificates \
# Cleanup unnecessary stuff
&& apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* /tmp/*
Why is it necessary to put this in a Dockerfile for selenium to run? (tested and won't run without the code). Why doesn't it simply work by using pip to install the selenium dependency?
Source: Firefox(headless)+selenium cannot access internet from docker container

Docker build returned a non-zero code:1 microsoft/dotnet

MY docker file Code
FROM microsoft/dotnet:2.1-sdk
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get update \
&& apt-get install -y nuget \
&& apt-get install --reinstall make \
&& apt-get install build-essential -y \
&& apt-get install awscli -y \
&& apt-get install jq -y \
&& apt-get install zip -y \
&& apt-get install -y mysql-server \
&& apt-get install -y mono-complete \
&& apt-get install -y libxml-xpath-perl \
&& apt-get install -y nodejs
In step run curl -sL. I'm getting the error,
The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get update && apt-get install -y nuget && apt-get install --reinstall make && apt-get install build-essential -y && apt-get install awscli -y && apt-get install jq -y && apt-get install zip -y && apt-get install -y mysql-server && apt-get install -y mono-complete && apt-get install -y libxml-xpath-perl && apt-get install -y nodejs' returned a non-zero code: 1
Anybody Know how to fix this error?
Curl is not installed install curl before running a curl command.
FROM microsoft/dotnet:2.1-sdk
RUN apt-get update \
&& apt-get install curl \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nuget \
&& apt-get install --reinstall make \
&& apt-get install build-essential -y \
&& apt-get install awscli -y \
&& apt-get install jq -y \
&& apt-get install zip -y \
&& apt-get install -y mysql-server \
&& apt-get install -y mono-complete \
&& apt-get install -y libxml-xpath-perl \
&& apt-get install -y nodejs

Resources