Build of docker image with centos:6.6 fails when trying to update repo - centos

I have the following simple Dockerfile:
FROM centos:6.6
USER root
RUN yum clean all
RUN yum update
And I am trying to build it as usual:
docker build -t myimage/hadoop .
But I have the following error and I can't find the solution:
Error: Cannot find a valid baseurl for repo: base Could not retrieve
mirrorlist
http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock
error was 14: PYCURL ERROR 6 - "Couldn't resolve host
'mirrorlist.centos.org'" INFO[0005] The command "/bin/sh -c yum
update" returned a non-zero code: 1
Any help or reference to solve the problem would be very helpful.
EDIT: I tried the solution given in this post but with no results.

Could you try add "-y" to the ""yum update"?
RUN yum update -y

Related

postgresql command not working; Error: invalid option '-o'

I am trying to fix this previous error when I am unable to find the PostgreSQL client library, however, when I run the suggested command:
ridk exec sh -c "pacman -S ${MINGW_PACKAGE_PREFIX}-postgresql"
I get this error. Not sure how to fix, any help is appreciated
error: invalid option '-o'
I tried the other suggestions such as:
gem install pg -- --with-pg-config=/path/to/pg_config
But I still get the same error.

Error: Error: Failed to download metadata for repo 'advanced-virtualization': Cannot prepare internal mirrorlist: No URLs in mirrorlist

I am using RHEL 9.1 machine where I am trying to install a package 'python3-distro' but I am getting error:
Error: Failed to download metadata for repo 'advanced-virtualization': Cannot prepare internal mirrorlist: No URLs in mirrorlist
can anyone please help me resolve this issue?
I was expecting 'sudo dnf install python3-distro' to work successfully.
I tried running below cmds:
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/*
and as result after reboot I am getting below error:
Error: Failed to download metadata for repo 'advanced-virtualization': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Output- ls 'yum.repos.d'
$ls /etc/yum.repos.d/
advanced-virtualization.repo nfv-openvswitch.repo redhat.repo
ceph-pacific.repo rdo-release.repo
messaging.repo rdo-testing.repo
Any help would be appreciated.

Getting Error in example Project for hyperledger sawtooth

I want to start this project https://github.com/hyperledger/education-sawtooth-simple-supply
My environment is Ubuntu 18.04.6 LTS , docker-compose version 1.17.1, Docker version 20.10.17, when i follow the instruction it pulls the container but in the end it stops with the error
Warning: apt-key output should not be parsed (stdout is not a terminal)
curl: (6) Could not resolve host: p80.pool.sks-keyservers.net
gpg: no valid OpenPGP data found.
ERROR: Service 'simple-supply-shell' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y -q curl gnupg && curl -sSL 'http://p80.pool.sks-keyservers.net/pks/lookup?op=get&search=0x8AA7AF1F1091A5FD' | apt-key add - && echo 'deb [arch=amd64] http://repo.sawtooth.me/ubuntu/chime/stable bionic universe' >> /etc/apt/sources.list && apt-get update' returned a non-zero code: 2
Your quick assistance is highly appreciated.
The only solution was that i changed the network option to Bridge Adapter in a virtual machine and it got worked im answering this because i have dont this if someone has resolved other way then post an answer here.

How to build Postgres jsonlog in multi-stage Docker container

I have a multi-stage Docker container where I build jsonlog.
# Build stage
FROM postgres:11.5 AS build-env
ADD . /jsonlog
RUN apt-get update && apt-get install -y build-essential libkrb5-dev libssl-dev libpq-dev postgresql-server-dev-all
RUN cd /jsonlog && make install
# Used find to see where the output files are being installed
# RUN find / -name "*json*"
# Final stage
FROM postgres:11.5-alpine
COPY --from=build-env /usr/lib/postgresql/11/lib/bitcode/jsonlog/jsonlog.bc /usr/lib/postgresql/11/lib/bitcode/jsonlog/jsonlog.bc
COPY --from=build-env /usr/lib/postgresql/11/lib/bitcode/jsonlog.index.bc /usr/lib/postgresql/11/lib/bitcode/jsonlog.index.bc
COPY --from=build-env /usr/lib/postgresql/11/lib/jsonlog.so /usr/lib/postgresql/11/lib/jsonlog.so
The docker build seems to be okay. However, when I do a docker run, I get this error.
LOG: invalid value for parameter "log_destination": "jsonlog"
DETAIL: Unrecognized key word: "jsonlog".
FATAL: configuration file "/etc/postgresql/postgresql.conf" contains errors
The jsonlog code comes from this repo, https://github.com/michaelpq/pg_plugins/tree/master/jsonlog, which I cloned. I mount just the jsonlog directory into the build container.
The postgresql.conf is vanilla, except for these lines.
log_destination = 'jsonlog'
logging_collector = on
shared_preload_libraries = 'jsonlog'
The reason for doing a multi-stage container is to get rid of build dependencies and have a smaller container. I'd like to run postgres:11.5-alpine, but I also get errors with the postgres:11.5 image.
Update
I tried getting rid of the multi-stage and just keeping everything in 1 container like this.
FROM postgres:11.5
ADD . /jsonlog
RUN apt-get update && apt-get install -y build-essential libkrb5-dev libssl-dev libpq-dev postgresql-server-dev-all
RUN cd /jsonlog && make install
But that results in the exact Unrecognized key word: "jsonlog" error.
Also, also, I tried building in a Postgres 9.5 container and the same thing happens.
It's my understanding that you simply leave log_destination as 'stderr' and the jsonlog plugin overrides the log_hook in PG and, magically, logs start coming out in JSON format.
So the only change needed, AFAIK, is:
shared_preload_libraries = 'jsonlog'

Run Kitura Docker Image causes libmysqlclient.so.18 Error

after i had some previous problem to Dockerise my MySQL Kitura SETUP here : Docker Build Kitura Sqift Container - Shim.h mysql.h file not found
I am running in a new Problem i can not solve following the Guide from : https://www.kitura.io/docs/deploying/docker.html .
After i followed all the steps and also did the fixing on the MySQL issue previously i was now able to run the following command :
docker run -p 8080:8080 -it myapp-run
THis however leads to the following issue :
error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
i assume something tries again to open the libmysqclclient from some wrong Environmental Directories ?
But how can i fix this issues by building the docker images ... is there any way and better a smart way ?
Thanks a lot again for the help.
I was able to update and enhance my dockerfile this is now running smoothly and also can be used for CI and CD tasks.
FROM ibmcom/swift-ubuntu-runtime:latest
##FROM ibmcom/swift-ubuntu-runtime:5.0.1
LABEL maintainer="IBM Swift Engineering at IBM Cloud"
LABEL Description="Template Dockerfile that extends the ibmcom/swift-ubuntu-runtime image."
# We can replace this port with what the user wants
EXPOSE 8080
# Default user if not provided
ARG bx_dev_user=root
ARG bx_dev_userid=1000
# Install system level packages
RUN apt-get update && apt-get dist-upgrade -y
RUN apt-get update && apt-get install -y sudo libmysqlclient-dev
# Add utils files
ADD https://raw.githubusercontent.com/IBM-Swift/swift-ubuntu-docker/master/utils/run-utils.sh /swift-utils/run-utils.sh
ADD https://raw.githubusercontent.com/IBM-Swift/swift-ubuntu-docker/master/utils/common-utils.sh /swift-utils/common-utils.sh
RUN chmod -R 555 /swift-utils
# Create user if not root
RUN if [ $bx_dev_user != "root" ]; then useradd -ms /bin/bash -u $bx_dev_userid $bx_dev_user; fi
# Bundle application source & binaries
COPY ./.build /swift-project/.build
# Command to start Swift application
CMD [ "sh", "-c", "cd /swift-project && .build/release/Beautylivery_Server_New" ]