Giter Club home page Giter Club logo

Comments (9)

Digoss avatar Digoss commented on May 18, 2024 2

I managed the issue changing the HOST_GID in the bootstrap script to store my system's Docker group identifier. Now I can to use the socket /var/run/docker.sock inside the container and run deploy script from my local environment.

from lamby.

Digoss avatar Digoss commented on May 18, 2024 1

I got the GID using the command getent group docker | cut -d: -f3

The build command looks like this:

docker-compose build \
  --build-arg HOST_UID="${HOST_UID:=$(id -u)}" \
  --build-arg HOST_GID="${HOST_GID:=$(getent group docker | cut -d: -f3)}"

Currently the image public.ecr.aws/sam/build-ruby2.7:1.27 contains a group named "input" that matches the "docker" group on my system.

from lamby.

metaskills avatar metaskills commented on May 18, 2024 1

I recently refactored the Lamby Cookiecutter to simplify a great many things. Should help, especially the devcontainer stuff. Review here:

Let me know if you have any questions. Docs coming soon on the new site.

from lamby.

Digoss avatar Digoss commented on May 18, 2024

I have the same issue
and my brainless solution was to change the user in docker-compose.yml from lamby to root

The short version: the containers user doesn't have permission to access /var/run/docker.sock.

Long version:
I have a default Ubuntu install. User and group share the same names and ids (uid and gid). e.g. x:x (1000:1000)
I followed the Post-installation steps for Linux and I created a new group called docker and added my user into it.
The Lamby docker image build uses my user and group IDs to create its own user/group. e.g. lamby:lamby
When docker-compose mounts /var/run/docker.sock it uses the docker group ID that the lamby container user doesn't belong to.
It causes the permission fault / Error: Building image for RailsLambda requires Docker. is Docker running?

from lamby.

metaskills avatar metaskills commented on May 18, 2024

This is not expected. The cookiecutter is written to work on Linux as far as I can tell... mostly because we encourage GitHub Actions which is a Linux host. I just did a test with the latest and it all worked. See here for details.

https://github.com/metaskills/lambytest42/actions/runs/1020165380

Since this issue was created I did do a small change to the cookiecutter. Basically leveraging the SAM docker tag on the development/test/build image. This should not make a difference, but I did want to share. https://github.com/metaskills/lambytest42/actions/runs/1020165380

Can you create a test project from the latest cookiecutter and verify it works or does not? If it does not, what could be happening that deploy works for GitHub Ubuntu latest Linux vs others?

from lamby.

metaskills avatar metaskills commented on May 18, 2024

Is it possible this issue is fixed via this comment? #100 (comment)

from lamby.

ihouse10 avatar ihouse10 commented on May 18, 2024

I also had success with changing the HOST_GID and HOST_UID. I changed the bootstrap script to also include to check for "Linux" in the if statement that sets HOST_GID and HOST_UID to 0.

if [ "$(uname -s)" = "Darwin" ] || [ "$(uname -s)" = "Linux" ]; then
  HOST_UID="0"
  HOST_GID="0"
fi

@metaskills This makes me wonder if we should change this indefinite without the if statement. Darwin is the MacOS I'm running it is working, and could this work for all other OS? Will this break in Github's Linux or Windows?

from lamby.

ihouse10 avatar ihouse10 commented on May 18, 2024

@Digoss Could you share your bootstrap script file? I would like to know how are you setting your system's Docker group identifier

from lamby.

metaskills avatar metaskills commented on May 18, 2024

Getting kind of hard to write good cross compatible Docker code. I've been playing a lot with GitHub Codespaces and think I may have found an easier pattern for the dev container stuff we have been pushing. Some details here:

aws/aws-sam-cli#921 (comment)

from lamby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.