IBM / BlueXolo

BlueXolo
Apache License 2.0
19 stars 20 forks source link

force Dockerfile to use Ubuntu 18.04 as a base to build bluexolo image #372

Closed daniel-zvpl closed 4 years ago

daniel-zvpl commented 4 years ago

trying to build a new Bluexolo a new error was get it. This error provoked that in one step during the building ,docker ask to type the time zone. And because during the building proces is not possible to type something, the building process got stuck. To solve it this issue next two lines was add to the DockerFile

ENV TZ=America/Mexico_City
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

After this the build process finished successfully, but now when the new Docker image try to run the error "/sbin/init does not exist" was gotten, to solve it only is necessary to add next line to the Dockerfile RUN apt-get install -y init

With this the container is able to start, but during the process when the container try to initialize the web-server the code broke, this was odd. After some investigation it was find that first line of Dockerfile is:

FROM ubuntu

What means this line is that every time when docker is trying to build a new image, the newer image of Ubuntu version will be used as a base. A couple of months ago Ubuntu release a new version, the version 20.04, there are many changes in this version, example: package /sbin/init is not installed by default, is necessary to set a time zone, different version of dependencies, etc.

Previous version of BlueXolo docker image was written using as base Ubuntu 18.04 this means that all the code of Dockerfile is coded to be able to run under Ubuntu 18.04. To migrate Dockerfile to use Ubuntu 20.04 there are so many changes (and test to ensure that everything works fine) to make the code able to use Ubuntu 20.04. It should be create a new git hub story to support the migration of Ubuntu 18.04 to 20.04

By now the fast solution is to force Docker to use the version 18.04 of Ubuntu. Making this the two above fixes are not necessary (set time zone, and install init package) To force this, in the Dockerfile the line

FROM ubuntu

is replace by the line

FROM ubuntu:18.04

Everything was tested and the new Docker image was build successfully, and everything is able to run without any problems.

NOTE: In the future it will be necessary to create a new Dockerfile that support Ubuntu 20.04, the good new is that is something that is not urgent. The reason is that Ubuntu 18.04 is a LTS version (long time support) the support for version 18.04 will end on April 2023.

During the process, the script docker/tools/build-image was used to build a image. To run this script in the console i moved to the directory where this script is stored, then i tried to run it using the command

./build-image

But this script failed, the two error are "filie not found" (when the script try to make the zip file) "file Dockerfile not found it"

checking the script the root cause of this error is that the first line of the script is cd ../ and should be a cd ../.. also after lines

 cd -
today=$(date +%Y-%m-%d_%H:%M)

is necessary to add the command cd .. after above lines, making this the script is able to run successfully

In order to be able to still building the docker image for BlueXolo is necessary to fix the issue with the Ubuntu version and add remainings cd.. commands to the script