I have a simple GO program which successfully connects to Vertica in my ubuntu server. I have setup the .dobc.ini and odbc drvier in this ubuntu.
db, err := sql.Open("odbc", "DSN=HPVerticaDSN")
if err != nil {
log.Fatal(err)
}
log.Println("DB ping started...")
if err = db.Ping(); err != nil {
log.Fatalf("DB ping failed with error...%v", err)
}
log.Println("DB connected.")
defer db.Close()
Now, How do I setup the Dockerfile to run this in docker container. Is it possible to use light weight base image like alpine or we have to use ubuntu base image. Any examples would be greatly appreciated.
Here is my Dockerfile
FROM alpine:latest
MAINTAINER Prataksha Gurung <prataksha.gurung@mydomain.net>
RUN apk add --no-cache ca-certificates
ADD libverticaodbc.so /libverticaodbc.so
ADD .odbc.ini ~/.odbc.ini
ADD main /usr/bin/main
ENTRYPOINT ["main"]
and I am getting
panic: standard_init_linux.go:178: exec user process caused "no such file or directory" [recovered]
panic: standard_init_linux.go:178: exec user process caused "no such file or directory"
when I run this container.
Finally I managed it to work with this dockerfile:
FROM ubuntu:artful
MAINTAINER Prataksha Gurung <prataksha.gurung@mydomain.net>
RUN apt-get update
RUN apt-get install -y curl
#downloading the relevant linux driver for this docker environment
RUN curl -O https://my.vertica.com/client_drivers/8.1.x/8.1.1-0/vertica-client-8.1.1-0.x86_64.tar.gz
RUN ls -la
RUN tar vzxf vertica-client-8.1.1-0.x86_64.tar.gz && rm vertica-client-8.1.1-0.x86_64.tar.gz
RUN apt-get install -y unixodbc-dev
ADD .odbc.ini /root/.odbc.ini #-->your custom DSN setup
ADD vertica.ini /root/vertica.ini #-->extra odbc driver setup
ADD main /usr/bin/main #-->binary executable
ENTRYPOINT ["main"]