issues in buiding Slate with Docker - docker-compose

I have tried to build slate using Docker, but modified changes are not affected when i compile the source. in my source path I have below files.
Dockerfile
FROM debian:latest
MAINTAINER Fed
VOLUME /usr/src/app/source
EXPOSE 4567
RUN apt-get update && \
apt-get install -y ruby git ruby-dev make gcc zlib1g-dev nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN gem install bundler
RUN git clone https://github.com/tripit/slate.git /slate
WORKDIR "/slate"
RUN bundle install
CMD ["bundle", "exec", "middleman", "server", "--force-polling"]
docker-compose.yml
slate:
build: .
ports:
- 4567:4567
volumes:
- ./source:/slate/source
- ./build:/slate/build
Makefile
.PHONY: build
build:
docker-compose build
up:
docker-compose up
compile:
docker-compose run slate bundle exec middleman build --clean
When I tried make compile output shows
docker-compose run slate bundle exec middleman build --clean
create build/stylesheets/screen.css
create build/stylesheets/print.css
create build/images/navbar.png
create build/images/logo.png
create build/fonts/slate.svg
create build/fonts/slate.woff
create build/fonts/slate.woff2
create build/fonts/slate.ttf
create build/fonts/slate.eot
create build/javascripts/all.js
create build/javascripts/all_nosearch.js
create build/index.html
Project built successfully
and when I execute make build
docker-compose build
Building slate
Step 1 : FROM debian:latest
---> 1b088884749b
Step 2 : MAINTAINER Fed
---> Using cache
---> f36ba5d1e018
Step 3 : VOLUME /usr/src/app/source
---> Using cache
---> d97292401c69
Step 4 : EXPOSE 4567
---> Using cache
---> 5ae0ecc71451
Step 5 : RUN apt-get update && apt-get install -y ruby git ruby-dev make gcc zlib1g-dev nodejs && apt-get clean && rm -rf /var/lib/apt/lists/*
---> Using cache
---> c83e099e40ee
Step 6 : RUN gem install bundler
---> Using cache
---> 4cc13ce89152
Step 7 : RUN git clone https://github.com/tripit/slate.git /slate
---> Using cache
---> 1ec325b7dc6b
Step 8 : WORKDIR "/slate"
---> Using cache
---> 8cc73cafc405
Step 9 : RUN bundle install
---> Using cache
---> 150ed469b196
Step 10 : CMD bundle exec middleman server --force-polling
---> Using cache
---> 9c2142617887
Successfully built 9c2142617887
and when I execute make up
docker-compose up
Starting docs_slate_1
Attaching to docs_slate_1
slate_1 | == The Middleman is loading
slate_1 | == View your site at "http://localhost:4567", "http://127.0.0.1:4567"
slate_1 | == Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
but when I go to browser(http://192.168.99.100:4567/- boot2docker ip) and check then it will shows original slate installation not my modified changes i have done to index.html.md file in source folder. The build folder in my path also have not been updated.
anyone can identify What i have done wrong here? I'm new to Docker.
Thanks.

Try this: docker-compose up --build

Related

how to run an app with flutter-pi from a docker container

I'm running a flutter app on a raspberry pi 4, I'm using flutter-pi. Everything works fine, but I want to take it to a higher level.
I want to encapsulate the app and all flutter-pi dependencies in a docker container.
I am using the ubuntu:jammy image as a base, I have installed all the dependencies according to flutter-pi.
When I run the app I get this error:
[locales] Warning: The system has no configured locale. The default "C" locale may or may not be supported by the app.
[keyboard] Could not load keyboard configuration from "/etc/default/keyboard". Default keyboard config will be used. load_file: No such file or directory
[flutter-pi] Could not query DRM device list: No such file or directory
NOTE: the raspberry is configured to do a console auto login and does not have a graphical interface
I have developed a flutter-pi application and encapsulated it in a container.
What I noticed is that this error (Could not query DRM device list: No such file or directory) happens to me only sometimes, the configuration is always the same but sometimes I faced it and some times I didn't.
I'm assuming it is related with the host system in which the docker containers are running, because as I previously said the configuration of the container is always the same in both the working container and the not working one.
I'm attaching down below the configuration of my dockerfile (it's made of 2 dockerfiles but it's only 1 container that I'm running, the second dockerfile uses the first one which is built in emotionsrl/tower-display-base).
The display_launcher.py only runs the flutter (flutter-pi --release ./spotlink_build) after a few checks that are not related with the rest.
FROM ubuntu
RUN apt -y update \
&& apt -y install git \
&& apt -y install wget \
&& apt -y install build-essential
WORKDIR /TOWER_DISPLAY
# STEP 1 DIPENDENZE
RUN git clone --depth 1 \
https://github.com/ardera/flutter-engine-binaries-for-arm.git \
engine-binaries && cd engine-binaries && ./install.sh
# STEP 2 DIPENDENZE
ENV TZ=Europe/Rome
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt -y install cmake \
libgl1-mesa-dev \
libgles2-mesa-dev \
libegl1-mesa-dev \
libdrm-dev \
libgbm-dev
RUN DEBIAN_FRONTEND='noninteractive' apt -y install ttf-mscorefonts-installer
RUN apt -y install fontconfig \
libsystemd-dev \
libinput-dev \
libudev-dev \
libxkbcommon-dev
#STEP 3 DIPENDENZE
RUN fc-cache
###########################
# COMPILING
RUN git clone https://github.com/ardera/flutter-pi
WORKDIR /TOWER_DISPLAY/flutter-pi/build
RUN cmake ..
RUN make -j `nproc`
RUN make install
FROM emotionsrl/tower-display-base
WORKDIR /TOWER_DISPLAY
COPY spotlink_build ./spotlink_build
COPY display_launcher.py ./display_launcher.py
CMD python3 ./display_launcher.py

MongoDB connection failed in ubuntu container

I create a docker container with the base image ubuntu:18.04 and installed MongoDB using the shell in this container. Now, I commit and export this container and use this container image as a base image in a new container in which I need the MongoDB status as running for further process. I am using Dockerfile for both containers.
First Dockerfileis :
#getting base image ubuntu
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y apt-utils wget gnupg gnupg2 curl
ENTRYPOINT ["tail", "-f", "/dev/null"]
CMD ["echo","Create base image"]
After building this Dockerfile, I accessed shell installed MongoDB, created a new db and collection, commit and export in the tar file.
Next, I import this tar file as image mongoubuntu:1.0
Now, I create another Dockerfile in which I want to run some commands which need MongoDB status as running.
The second Dockerfile is as follows:
FROM mongoubuntu:1.0
RUN apt-get update && apt-get -y install sudo && apt-get -y install curl
RUN apt-get install -y wget #install wget lib
COPY . /
RUN chmod +x /genesis.sh
RUN /genesis.sh
RUN chmod +x /wallet.sh
RUN /wallet.sh >> /config.sh
ENTRYPOINT ["tail", "-f", "/dev/null"]
CMD ["echo","Install EOS Complete"]
When I run this as docker build -t eossample:1.5 . It gets build successful. When I check the bash shell for the newly created container using this image, MongoDB is not running. If I manually start MongoDB it shows running status. Please help. How could I start MongoDB from DockerFile?

How to build an image of Postgres:11 with HLL extension?

I want to make a Dockerfile to build an image of Postgres:11 that already installed postgresql-hll extension inside.
Im not experienced with Docker so Im have no idea to follow the instruction of installing this extension properly.
In order to do this you need to:
clone the git repository:
git clone https://github.com/citusdata/postgresql-hll.git
Create a file called Dockerfile (at the same level with the folder postgresql-hll created at step 1) with the contents:
ARG psversion=11
FROM postgres:$psversion
COPY postgresql-hll /postgresql-hll
RUN apt-get update -y && apt-get install -y postgresql-server-dev-${PG_MAJOR} make gcc g++
WORKDIR /postgresql-hll
RUN PG_CONFIG=/usr/bin/pg_config make
RUN PG_CONFIG=/usr/bin/pg_config make install
RUN echo "shared_preload_libraries = 'hll'" >> /usr/share/postgresql/postgresql.conf.sample
COPY create_extension.sql /docker-entrypoint-initdb.d/
Create a file create_extension.sql at the same level with the Dockerfile, with the contents:
CREATE EXTENSION hll;
Build your image:
# build for POSTGRES 11
docker build -t hll:1.0 --build-arg psversion=11 .
# build for POSTGRES 9.6
docker build -t hll:1.0 --build-arg psversion=9 .
NOTE: The version for POSTGRES 9.6 gives an error when trying to load the library. It is here for completeness and maybe somebody can contribute to fix it.
Run a container based on this image
docker run -d --name hll hll:1.0
Open a shell in the newly created container:
docker exec -ti hll bash
Inside the container run:
su postgres
psql
\dx
The output should show the hll extension as installed.

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" ]

CommandError: /code/manage.py already exists, overlaying a project or app into an existing directory won't replace conflicting files

I'm trying to run linux docker on windows and getting this error.
build was fine.
'''
$ docker-compose build
Building web
Step 1/11 : FROM python:3
---> 42d620af35be
Step 2/11 : ENV PYTHONUNBUFFERED 1
---> Using cache
---> b43065732d6e
Step 3/11 : RUN apt-get update -y
---> Using cache
---> 6f65e0da9e14
Step 4/11 : RUN apt-get install -y unixodbc unixodbc-dev
---> Using cache
---> 2a9d7445a991
Step 5/11 : RUN easy_install pip
---> Using cache
---> 5994e6452e09
Step 6/11 : RUN mkdir /code
---> Using cache
---> d0eaa870fb98
Step 7/11 : WORKDIR /code
---> Using cache
---> af78d4b35f26
Step 8/11 : RUN pip uninstall django
---> Using cache
---> 92f983bfef88
Step 9/11 : COPY requirements.txt /code/
---> Using cache
---> 3c0031987286
Step 10/11 : RUN pip install -r requirements.txt
---> Using cache
---> 3915127d3d58
Step 11/11 : COPY . /code/
---> Using cache
---> de872685c733
Successfully built de872685c733
Successfully tagged djangoproject_web:latest
'''
but when i run compose up.. i see below error.
'''
$ docker-compose up
Creating djangoproject_web_1 ... done
Attaching to djangoproject_web_1
web_1 | Watching for file changes with StatReloader
web_1 | Performing system checks...
web_1 |
web_1 | System check identified no issues (0 silenced).
web_1 |
web_1 | You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
web_1 | Run 'python manage.py migrate' to apply them.
web_1 | July 23, 2019 - 03:21:21
web_1 | Django version 2.2.3, using settings 'composeexample.settings'
web_1 | Starting development server at http://case.xxxxxx.com:8000/
web_1 | Quit the server with CONTROL-C.
web_1 | Error: [Errno -2] Name or service not known
djangoproject_web_1 exited with code 1
'''
and if i try this
'''
docker-compose run web django-admin startproject composeexample .
'''
it says
'''
CommandError: /code/manage.py already exists, overlaying a project or app into an existing directory won't replace conflicting files
'''
my Dockerfile is
'''
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN apt-get update -y
RUN apt-get install -y unixodbc unixodbc-dev
RUN easy_install pip
RUN mkdir /code
WORKDIR /code
RUN pip uninstall django
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
'''
my docker-compose.yml is
'''
version: '3'
services:
web:
build: .
command: python manage.py runserver case.xxxxxx.com:8000
volumes:
- .:/code
ports:
- "8000:8000"
'''
How can i fix the problem with composeexample? it is not even created (cause i can't see it in the folder).. your advice please.
You are probably using the docker client of Ubuntu Windows Subsystem. This gives issues with Volume feature of docker.
Run the docker run command on windows powershell and this issue will not come.
This error occurs if you try to create another project in a single virtual environment. To remove error and create next project delete "manage.py file" which is the file automatically created while starting project.
If you still get error delete the virtual environment and delete manage.py
You have 2 conflicting/overwriting statements:
In your Dockerfile:
COPY . /code/
in your docker-compose.yml:
volumes:
- .:/code
I suggest you remove the COPY statement from the Dockerfile and re-run your containers using docker-compose.
Also, you can remove the RUN command here:
RUN mkdir /code
WORKDIR /code
It is not an error, but WORKDIR already creates the folder if it doesn't exist anyway.
The problem is, you are trying to create a project that is already created by re-running the command
docker-compose run web django-admin startproject composeexample .
Just run
docker-compose run web