I'm working with hashicorp/terraform:latest image (which is very minimal) and need to install go. After installing go into /usr/local. As a next step we need to update $PATH so that we could run go commands. But the export PATH does not take and the shell can't find go executable which is in /usr/local/go/bin.
We can't quite figure out how to go about this. Help is greatly appreciated!
```
```
Hi @Misha (HS),
I have tried to reproduce this locally by running a Docker container with the image you are using:
docker run -it --entrypoint=/bin/sh hashicorp/terraform:latest
and then I executed the commands you have in your yml file (apart from lines 3 and 4 of the script)
The command go version also fails when debugging this locally.
If I try the installation in a different Docker container, e.g. atlassian/default-image:3 which is based on Ubuntu, the installation of go seems to succeed (both locally and in Pipelines).
It is possible that the file you are downloading is not the correct one for Alpine Linux or extra/different steps may be needed for the installation in Alpine. I'm afraid I don't know what exactly is causing the problem here, but it seems to be specific to the Linux distribution of the Docker image.
Kind regards,
Theodora
Oh, great, thank you Theodora. I will play with the image. It looks like Alpine does not like the compiled for amd64 go binary. I will update this ticket with what I find.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pre-compiled go binary seems not to be compatible with alpine.
You can see an example of how to build go from source on alpine at this dockerfile
https://github.com/docker-library/golang/blob/67757c0feeb9867a54801ca378dcfc55b9db7e70/1.17/alpine3.15/Dockerfile
Better option would be as suggested already by Atlassian team to use another image based on Debian / Ubuntu
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for posting that example Jack!
@Misha (HS), I also found the following blog post, the solution suggested there is to install go with apk:
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there maybe you must add execution permissions to go binary?
chmod a+x /usr/local/go/bin/go
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What I'm getting is file not found (not a permission issue)
/opt/atlassian/pipelines/agent/tmp/shellScript5553201990805023401.sh: line 37: go: not found
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.