Galera Cluster Dockerfile - mysql

I'm trying to create a galera docker image based on this dockerfile file from this link
http://galeracluster.com/documentation-webpages/docker.html
FROM ubuntu:14.04
MAINTAINER your name <your.user#example.org>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv BC19DDBA
RUN add-apt-repository 'deb http://releases.galeracluster.com/ubuntu trusty main'
RUN apt-get update
RUN apt-get install -y galera-3 galera-arbitrator-3 mysql-wsrep-5.6 rsync
COPY my.cnf /etc/mysql/my.cnf
ENTRYPOINT ["mysqld"]
But I get this error
W: Failed to fetch http://releases.galeracluster.com/ubuntu/dists/trusty/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Can you please help me !! It used to work fine for me two weeks ago !! any idea ??

Related

TravisCI - Google Chrome stable cannot be authenticated

I'm trying to add TravisCI to my project, but I won't stop getting this error when triggering the builds:
WARNING: The following packages cannot be authenticated!
google-chrome-stable E: There were unauthenticated packages and -y was
used without --allow-unauthenticated apt-get.diagnostics apt-get
install failed The command "sudo -E apt-get -yq --no-install-suggests
--no-install-recommends $(travis_apt_get_options) install google-chrome-stable" failed and exited with 100 during .
I've searched for an answer and I found that adding chrome: stable in the addons section should fix it, but it's still failing. This is the .travis.yml file:
dist: trusty
sudo: false
language: node_js
node_js:
- "10"
addons:
chrome: stable
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
cache:
directories:
- ./node_modules
install:
- cd project/projectName
- npm install
script:
- npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
- npm run e2e -- --protractor-config=e2e/protractor-ci.conf.js
And this is the full log:
Worker information
0.17s0.01s0.00s0.01s
system_info
Build system information
0.00s0.00s6.03s0.00s4.23s0.00s1.26s
docker_mtu_and_registry_mirrors
docker stop/waiting
resolvconf
resolvconf stop/waiting
Adding APT Sources
0.16s$ curl -sSL "https://build.travis-ci.com/files/gpg/google-chrome.asc" | sudo -E apt-key add -
OK
0.01s$ echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list >/dev/null
7.82s$ travis_apt_get_update
Installing APT Packages
0.50s$ sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install google-chrome-stable
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
indicator-application libappindicator1 libappindicator3-1 libdbusmenu-glib4
libdbusmenu-gtk3-4 libdbusmenu-gtk4 libindicator3-7 libindicator7
Use 'sudo apt autoremove' to remove them.
Recommended packages:
libu2f-udev libvulkan1
The following packages will be upgraded:
google-chrome-stable
1 upgraded, 0 newly installed, 0 to remove and 303 not upgraded.
Need to get 75.8 MB of archives.
After this operation, 59.1 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
google-chrome-stable
E: There were unauthenticated packages and -y was used without --allow-unauthenticated
apt-get.diagnostics
apt-get install failed
The command "sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install google-chrome-stable" failed and exited with 100 during .
Your build has been stopped.
How could I fix this? Also, since the root folder (where the .travis.yml file is) isn't where the app is located (it is under root/project/projectName), I wrote - cd project/projectName before doing the -npm install, I don't know if thats the correct way of doing it, so I'd also like to check that.
Thanks!

how to kill process holding the apt lock

I'm updating apt and installing mysql-client at run time to a ubuntu 18.04 aws instance.
My shell command are like,
- apt-get update
- apt-get install -y mysql-client
- apt-get install -y unzip
But 'apt-get install -y mysql-client' hang and lock apt. Therefor 'apt-get install -y unzip' get fail. So to proceed this, I have to manually kill the process and unclock the apt from following commands.
Step 01. ps -ef | grep apt
Step 02. kill -9
Step 03. sudo dpkg --configure -a
Step 04. Yes the below message
restarts will be done for you automatically so you can avoid being asked questions on each library upgrade. │ Restart services during package upgrades without asking?
Step 05. apt-get install -y mysql-client
My question is how I implement following from shell script or is there a any way to install mysql-client at run time?
Try to set DEBIAN_FRONTEND=noninteractive and the -q parameter to avoid apt from opening interactive prompts.
e.g:
DEBIAN_FRONTEND=noninteractive apt-get install -yq mysql-client

How to install mysql-server in a Dockerfile?

I have a complex Dockerfile which install much more than just mysql-server so I cannot start from an existing mysql container.
When removing all the extra-stuff I get this Dockerfile
FROM ubuntu:latest
ENV MYSQL_ROOT_PASSWORD=root
ENV MYSQL_ROOT_USER=root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y mysql-server
RUN usermod -d /var/lib/mysql/ mysql
RUN service mysql start
Unfortunately, mysql does not want to start:
---> 57a66bd64c2c
Step 8/9 : RUN usermod -d /var/lib/mysql/ mysql
---> Running in 596df248c2e4
---> ee78442bcc56
Step 9/9 : RUN service mysql start
---> Running in 0d9e5803cf33
* Starting MySQL database server mysqld
...fail!
The command '/bin/sh -c service mysql start' returned a non-zero code: 1
What is my mistake?
Looks like you've removed the most important parts of your docker file. Here is the Official MySQL repo Docker file.
FROM oraclelinux:7-slim
ENV PACKAGE_URL https://repo.mysql.com/yum/mysql-8.0-community/docker/x86_64/mysql-community-server-minimal-8.0.2-0.1.dmr.el7.x86_64.rpm
# Install server
RUN rpmkeys --import http://repo.mysql.com/RPM-GPG-KEY-mysql \
&& yum install -y $PACKAGE_URL \
&& yum install -y libpwquality \
&& rm -rf /var/cache/yum/*
RUN mkdir /docker-entrypoint-initdb.d
VOLUME /var/lib/mysql
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 3306 33060
CMD ["mysqld"]
You need to include a proper source with correct version to pull the image from.
and expose right ports, separate out volumes for MySQL to run. your container maybe failing due to any of this. I'd say remove the MySQL part out of your dockerfile and run the rest of the container.
Use the official mySQL image and install it in separate container. and then you can connect the Database with other apps.

Could not install mysql-server inside docker container

I want to configure a container with MySQL, thereafter I will add a java application to the container. But, I could not install MySQL-server inside the container.
here is my dockerfile:
FROM ubuntu:latest
RUN apt-get -y update
RUN apt-get -y install mysql-server --fix-missing --fix-broken
EXPOSE 3306
CMD ["/usr/bin/mysqld_safe"]
I got the following error:
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-5.5_5.5.44-0ubuntu0.14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
2015/09/01 13:17:36 The command [/bin/sh -c apt-get -y install mysql-server --fix-missing --fix-broken] returned a non-zero code: 100
What's probably happening is the apt-get install is asking for input, and failing. What happens if you just run those commands interactively in the base container? e.g. launch a shell with docker run -ti --rm ubuntu:latest /bin/bash
One thing you can try is to use the DEBIAN_FRONTEND=noninteractive environment variable, e.g.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -yq install mysql-server
I would suggest you use the official mysql docker image. When running that you have to provide the root password as an environment variable during the docker run command. That would be better.

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