Selective apt-get failure using Docker - apt-get

I prepared and tested a dockerfile before sending it to a client, on whose machine, the build process is running into apt-get errors.
Here is a of some of the package download failures.
It doesn't seem to be a proxy issue since most packages, and some wgets, are working fine. I'm not getting any such errors on my own machine, so I'm at a loss as to how to go about debugging the problem. Any leads?
I am particularly curious what the 400 bad request error indicates. Does it have something to do with the 404 leading up to it?
EDIT: Here is a link to the Dockerfile.

Had this happen to a co-worker. The only thing we change was
RUN apt-get update -y && apt-get install ...
TO
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y
I tried all sorts of things, but this was the only thing that worked for me.

Related

Dockerfile running from Mysql cannot access apt-get

When I run docker-compose up to install our MySQL server, I get the following error:
RUN apt-get -y update && apt-get upgrade -y:
/bin/sh: apt-get: command not found
from the relevant dockerfile code:
FROM mysql:5.7
RUN apt-get -y update && apt-get upgrade -y
This used to work fine a few months ago for my coworkers.
Apparently since Oracle bought MySQL in 2010, they have been converting everything over to their proprietary OS. In the last few months, they switched the default mysql package to Oracle OS from Debian.
See the packages here: https://hub.docker.com/_/mysql
You now need to specify the debian package like:
FROM mysql:5.7-debian
RUN apt-get -y update && apt-get upgrade -y

Installation of MySQL 5.7 on Debian 7 Wheezy

I would like to install MySql 5.7 on Debian 7 Wheezy. I put :
deb http://repo.mysql.com/apt/debian/ wheezy mysql-5.7
in file:
/etc/apt/sources.list.d/mysql.list
Next I run commands:
sudo apt-get update
sudo apt-get upgrade
And tried install package:
sudo apt-get install mysql-server-5.7
I got an error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'mysql-community-server' instead of 'mysql-server-5.7'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mysql-community-server : Depends: mysql-common (= 5.7.11-1debian7) but 5.5.47-0+deb7u1 is to be installed
Depends: mysql-client (= 5.7.11-1debian7)
E: Unable to correct problems, you have held broken packages.
Do you have any ideas to resolve this problem?
I also tried:
Note, selecting 'mysql-community-server' instead of 'mysql-server-5.7'
But it's not the solution of the problem.
I stumbled upon this post and can confirm simply changing the priority of your cache by downloading the .deb package directly from MySQL Downloads
Using the command line:
$ cd /usr/src && sudo wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
Please note: by convension the /src directory on linux exists for source code to live before being compiled - I believe the deb package above therefore belongs here.
This works for Debian/Wheezy.
$ sudo dpkg -i http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
Once this you have gone through the steps, you simply hit Ok, and then proceed to install mysql-server like normal:
$ sudo apt-update
$ sudo apt-get install mysql-server
For me, this resulted in the following:
[info] MySQL Community Server 5.7.14 is started.
Setting up mysql-server (5.7.14-1debian7) ...
Further reading, if you ever want to remove this package, you can do so:
$ cd /usr/src && sudo dpkg --remove http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
As of 2020 with Debian Wheezy 7.11 the answer doesn't work anymore. I had to change a few things and thought it might be useful to share the result:
Install mysql-apt-config_0.8.10-1_all.deb (Version 0.8.15-1_all won't work: dpkg can't handle the "control.tar.xz" it contains.)
cd /usr/src
sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
This will create the necessary /etc/apt/sources.list.d/mysql.list file.
sudo apt-get update
sudo apt-get install mysql-server
Thanks goes to David Kehr from where I got the working mysql-apt-config version.
You don't need to specify the version in the apt-get command, just type :
sudo apt-get install mysql-server
After the install, you can type the following command to check mysql version
aptitude show mysql-server
On my machine I have the following result :
...
VersionĀ : 5.7.13-1debian7
...

MySQL installation

I'm trying to install mysql-client so I use :
sudo apt-get install mysql-server mysql-client
it loads some packages then it asks the classic :
Do you want to continue [Y/n]?
the problem is : even if type Y the installation aborts
Have you tried adding -y to the command? This should override the prompt. So it will look like:
sudo apt-get install -y mysql-server mysql-client
(Source: https://askubuntu.com/questions/509852/why-does-apt-get-abort-by-itself-as-though-id-pressed-n )
-y option of apt-get install is just automatic yes to prompts and run non-interactively. It will also abort the installation for undesirable situation such as changing a held package or removing an essential package. The issue might be different, paste the output after you say Yes/Y.

Docker and MySQL can't connect

I can't for the life of me figure this out. I feel like I'm really close, but im just not quite there yet. Here's my Dockerfile:
FROM ubuntu:14.04
MAINTAINER Oscar Godson
RUN apt-get update
RUN apt-get install -y nodejs-legacy
RUN apt-get install -y npm
RUN apt-get install -y mysql-server
RUN apt-get install -y mysql-client
COPY . /src
WORKDIR /src
RUN service mysql start;\
mysql -u root < /src/bin/demo-data.sql;\
npm install
EXPOSE 4000
CMD ["node", "index.js"]
If i go into interactive mode and go into bash in that RUN service... line at the end I can see that mysql is running, the demo data was imported and everything works including starting my Node app with node index.js. If I then try to do another RUN or the CMD you see below it no longer can access MySQL. It's like it stops running.
The error I get Error: connect ECONNREFUSED which happens when it's down or the data isn't there. From me playing with it it looks like MySQL isn't running if I try to access it after the RUN where I start it.
P.S. The MySQL DB here is purely for development. On production we use AWS RDS, so thats why its using root without any password and importing data that way.
The problem was that RUN shouldn't be used for long running processes, however, you can only use one CMD option. For some reason it didn't click with me until a friend pointed it out, but I could just make a "installer.sh" script and call that with CMD. Now it's not losing the MySQL context. My update Dockerfile looks something like this:
FROM ubuntu:14.04
MAINTAINER Oscar Godson
RUN apt-get update
RUN apt-get install -y nodejs-legacy
RUN apt-get install -y npm
RUN apt-get install -y mysql-server
RUN apt-get install -y mysql-client
COPY . /src
WORKDIR /src
RUN cd /src;npm install
EXPOSE 4000
CMD ./bin/installer.sh
Installer than has
service mysql start
mysql -u root < ./bin/demo-data.sql
node index.js

Error while installing postgreSQL database

I have to change my databasefrom MySQL to postgreSQL in django. But postgreSQL is not installing .
Error while installing postgreSQL using commands-
sudo apt-get update && sudo apt-get upgrade
sudo apt-get purge postgresql*
sudo apt-get -f install
sudo apt-get install postgresql
At terminal-
(jango)dc#dc-comp-4:~/website$ sudo apt-get install postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
postgresql : Depends: postgresql-9.3 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
but its not working.how can i do this.and what changes i have to made. Plz help
aptitude might be able to resolve this issue. It's a more sophisticated dependency management tool than apt-get.
You may install it with apt-get:
sudo apt-get install aptitude
You may use aptitude to install postgresql
sudo aptitude install postgresql-9.3
If aptitude encounters any problems it automatically devises a possible solution to install this package. Be aware that aptitude might suggest remove conflicting packages. So if you get prompted by aptitude please read the prompt carefully.