TDengine icon indicating copy to clipboard operation
TDengine copied to clipboard

Can't build a docker image based on alpine

Open RockyNiu opened this issue 7 years ago • 7 comments

Dockerfile:

FROM alpine AS builder
RUN apk add --no-cache git\
    && apk add --no-cache build-base\
    && apk add --no-cache cmake
RUN git clone https://github.com/taosdata/TDengine.git
WORKDIR /TDengine
RUN mkdir build && cd build && cmake .. && cmake --build .

The error:

-- Use the iconv functions in GLIBC
-- build version 
CMake Error at src/client/CMakeLists.txt:31 (SET_TARGET_PROPERTIES):
  SET_TARGET_PROPERTIES called with incorrect number of arguments.

-- MVN is not installed and JDBC is not compiled
-- Configuring incomplete, errors occurred!

RockyNiu avatar Jul 16 '19 21:07 RockyNiu

@RockyNiu What`s your cmake version?

francis-du avatar Jul 17 '19 00:07 francis-du

3.14.5-r0

The following is the full logs

Sending build context to Docker daemon   12.8kB
Step 1/5 : FROM alpine AS builder
 ---> b7b28af77ffe
Step 2/5 : RUN apk add --no-cache git    && apk add --no-cache build-base    && apk add --no-cache cmake
 ---> Running in 4a53c1eb569a
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/6) Installing ca-certificates (20190108-r0)
(2/6) Installing nghttp2-libs (1.38.0-r0)
(3/6) Installing libcurl (7.65.1-r0)
(4/6) Installing expat (2.2.7-r0)
(5/6) Installing pcre2 (10.33-r0)
(6/6) Installing git (2.22.0-r0)
Executing busybox-1.30.1-r2.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 21 MiB in 20 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/18) Installing binutils (2.32-r0)
(2/18) Installing libmagic (5.37-r0)
(3/18) Installing file (5.37-r0)
(4/18) Installing gmp (6.1.2-r1)
(5/18) Installing isl (0.18-r0)
(6/18) Installing libgomp (8.3.0-r0)
(7/18) Installing libatomic (8.3.0-r0)
(8/18) Installing libgcc (8.3.0-r0)
(9/18) Installing mpfr3 (3.1.5-r1)
(10/18) Installing mpc1 (1.1.0-r0)
(11/18) Installing libstdc++ (8.3.0-r0)
(12/18) Installing gcc (8.3.0-r0)
(13/18) Installing musl-dev (1.1.22-r2)
(14/18) Installing libc-dev (0.7.1-r0)
(15/18) Installing g++ (8.3.0-r0)
(16/18) Installing make (4.2.1-r2)
(17/18) Installing fortify-headers (1.1-r0)
(18/18) Installing build-base (0.5-r1)
Executing busybox-1.30.1-r2.trigger
OK: 179 MiB in 38 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/11) Installing libacl (2.2.52-r6)
(2/11) Installing libbz2 (1.0.6-r7)
(3/11) Installing lz4-libs (1.9.1-r0)
(4/11) Installing xz-libs (5.2.4-r0)
(5/11) Installing libarchive (3.3.3-r0)
(6/11) Installing ncurses-terminfo-base (6.1_p20190518-r0)
(7/11) Installing ncurses-terminfo (6.1_p20190518-r0)
(8/11) Installing ncurses-libs (6.1_p20190518-r0)
(9/11) Installing rhash-libs (1.3.8-r0)
(10/11) Installing libuv (1.29.1-r0)
(11/11) Installing cmake (3.14.5-r0)
Executing busybox-1.30.1-r2.trigger
OK: 214 MiB in 49 packages
Removing intermediate container 4a53c1eb569a
 ---> ef18ddbdbdf6
Step 3/5 : RUN git clone https://github.com/taosdata/TDengine.git
 ---> Running in 9f7ca88ffbb8
Cloning into 'TDengine'...
Removing intermediate container 9f7ca88ffbb8
 ---> 39a7f24b3720
Step 4/5 : WORKDIR /TDengine
 ---> Running in 928dc04f2f26
Removing intermediate container 928dc04f2f26
 ---> c95d29dee639
Step 5/5 : RUN mkdir build && cd build && cmake .. && cmake --build .
 ---> Running in ed4d9b0f9c1a
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Project source directory: /TDengine
-- Build Debug Version
-- Project binary output path: /TDengine/build
-- Executable files output path: /TDengine/build/build/bin
-- Project library output path: /TDengine/build/build/lib
-- Check targe platform x64, pass
-- Use the iconv functions in GLIBC
-- build version 
CMake Error at src/client/CMakeLists.txt:31 (SET_TARGET_PROPERTIES):
  SET_TARGET_PROPERTIES called with incorrect number of arguments.


-- MVN is not installed and JDBC is not compiled
-- Configuring incomplete, errors occurred!
See also "/TDengine/build/CMakeFiles/CMakeOutput.log".
The command '/bin/sh -c mkdir build && cd build && cmake .. && cmake --build .' returned a non-zero code: 1

RockyNiu avatar Jul 17 '19 03:07 RockyNiu

I ran into same issue. I think alpine, being extremely minimal, is missing some required libraries/functions. For example, I saw pthread being used by taosd, but it is not part of alpine.

Use ubuntu instead (for both docker build stages) worked for me. The image is a little bigger at 72MB (64MB ubuntu + 8MB TDengine), but still small enough for all practical purposes. You can save a few MB if only taosd is copied over.

FROM ubuntu AS build-env

RUN apt-get update
RUN apt-get -y install git
RUN apt-get -y install build-essential
RUN apt-get -y install cmake

RUN git clone https://github.com/taosdata/TDengine.git
RUN mkdir build && cd build && cmake ../TDengine && cmake --build .

FROM ubuntu
WORKDIR /app
ADD ./taos.cfg /app
COPY --from=build-env /build/build/bin/* /app/
RUN mkdir -p /data/log
ENTRYPOINT ["./taosd", "-c", "."]

tedwuusa avatar Jul 17 '19 08:07 tedwuusa

There is a blog using Centos image to build and run TDengine. You can refer to it. Besides, official docker image is on the road. We also invite that you can contribute the docker image.

hzcheng avatar Jul 19 '19 10:07 hzcheng

Still struggling with alpine, since TDengine is for IoT and alpine is necessary distro to be supported.

With ver1.6.4.3, TDengine is still not able to be built. Since alpine is not using glibc but musl (the libc for alpine), while TDengine uses glibc.

It will take lots of code changes to support Alpine. Take care!

xrdavies avatar Dec 19 '19 09:12 xrdavies

There is a blog using Centos image to build and run TDengine. You can refer to it. Besides, official docker image is on the road. We also invite that you can contribute the docker image.

To run with other distro is so easy that not so challenge compared to running on Alpine. Hope I can fix this issue soon.

xrdavies avatar Dec 19 '19 10:12 xrdavies

Fixed in #971

xrdavies avatar Dec 20 '19 03:12 xrdavies