Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work in docker container #316

Open
vhar opened this issue Jul 15, 2023 · 7 comments
Open

Not work in docker container #316

vhar opened this issue Jul 15, 2023 · 7 comments
Labels
1sp question Further information is requested teamE

Comments

@vhar
Copy link

vhar commented Jul 15, 2023

Sorry, I can't reopen the #315 issue.

Unfortunately, nothing helped.

  1. If run the application
go run ./main.go -tags go_tarantool_ssl_disable 
  • the same errors.
  1. If install opensll to golang:1.20-alpine container - the same errors
    Dockerfile
FROM golang:1.20-alpine
WORKDIR "/usr/src/tarantool"

RUN apk add --update openssl && \
    rm -rf /var/cache/apk/*
  1. If build a custom container from ubuntu:latest - the same errors
    Dockerfile
FROM ubuntu:latest
WORKDIR "/usr/src"

RUN apt-get update \
    && apt-get -y install \
    wget \
    tar \
    openssl \
    ca-certificates \
    libssl-dev \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

RUN update-ca-certificates -v

RUN wget https://go.dev/dl/go1.20.6.linux-amd64.tar.gz \
    && tar -C /opt -xzf go1.20.6.linux-amd64.tar.gz

ENV PATH="$PATH:/opt/go/bin"
@oleg-jukovec
Copy link
Collaborator

oleg-jukovec commented Jul 15, 2023

I'll check the docker images in a few days.

I'm sorry, you need to run the application with the command if you don't need OpenSSL/TLS support:

go run -tags go_tarantool_ssl_disable ./main.go

instead of:

go run ./main.go -tags go_tarantool_ssl_disable

@oleg-jukovec oleg-jukovec added question Further information is requested teamE labels Jul 15, 2023
@oleg-jukovec oleg-jukovec self-assigned this Jul 15, 2023
@DifferentialOrange
Copy link
Member

DifferentialOrange commented Jul 17, 2023

For the future generations: I've had similar issue using

go build -tags go_tarantool_ssl_disable -tags go_tarantool_call_17

instead of

go build -tags go_tarantool_ssl_disable,go_tarantool_call_17

It really hard to distinct invalid tag setup from tags not working in Go.

@siller174
Copy link

@DifferentialOrange
If I want to user ssl in docker container, how I should fix it?

@oleg-jukovec
Copy link
Collaborator

oleg-jukovec commented Aug 3, 2023

@DifferentialOrange If I want to user ssl in docker container, how I should fix it?

You need to install OpenSSL + dev files for compilation into the image before build.

@siller174
Copy link

FROM        golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build
WORKDIR     /build
COPY        . .
RUN         alpk update && apk add openssl && \
          go build -o ./bin/app ./cmd/...
# github.com/tarantool/go-openssl
vendor/github.com/tarantool/go-openssl/net.go:25:7: undefined: Ctx
vendor/github.com/tarantool/go-openssl/net.go:44:43: undefined: Ctx
vendor/github.com/tarantool/go-openssl/net.go:52:41: undefined: Ctx
vendor/github.com/tarantool/go-openssl/net.go:80:38: undefined: Ctx
vendor/github.com/tarantool/go-openssl/net.go:80:62: undefined: Conn
vendor/github.com/tarantool/go-openssl/net.go:90:68: undefined: Ctx
vendor/github.com/tarantool/go-openssl/net.go:91:21: undefined: Conn
vendor/github.com/tarantool/go-openssl/net.go:109:45: undefined: Ctx
vendor/github.com/tarantool/go-openssl/net.go:110:20: undefined: Conn
vendor/github.com/tarantool/go-openssl/net.go:115:59: undefined: Ctx
vendor/github.com/tarantool/go-openssl/net.go:115:59: too many errors

@oleg-jukovec
Copy link
Collaborator

I think you don't install header files for the OpenSSL or a C compiler or something wrong with the environment. We have an example how to build OpenSSL, but on CI, not inside a docker image:

https://github.com/tarantool/tt/blob/5fea6e16448598c67afa534e93010f4b1d2f70ae/.github/workflows/publish.yml#L31-L37
https://github.com/tarantool/tt/blob/5fea6e16448598c67afa534e93010f4b1d2f70ae/.github/workflows/publish.yml#L61-L67

But it could help.

@vhar
Copy link
Author

vhar commented Aug 17, 2023

I showed above an example of how I build custom docker container. Everything that is needed is installed in it (openssl, libssl-dev) , but at startup it still has the same errors.
If install samething on a virtual machine with the same options, then there are no errors. This is clearly a problem when working with a docker container.
I took the advice and start program with the go_tarantool_ssl_disable tag. Everything works without problems.

@oleg-jukovec oleg-jukovec removed their assignment Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1sp question Further information is requested teamE
Projects
None yet
Development

No branches or pull requests

4 participants