-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[aws-lambda-nodejs] running cdk in a container breaks bundling since docker is not present #9348
Comments
I believe you simply need to setup your build environment so it can run docker (regardless of the CDK). The bundling process simply invokes You can also set the environment variable |
yes that is already done. It starts a container which runs
|
so I investigated that a little. Well its not directly attached to cdk but nevermind... In my Dockerfile I added |
well after a few tries I don't get it running. Well the container starts but it brings several errors. It has something todo with the volumes ` Error: Entry /asset-input/src/** does not exist But from my perspective starting docker from docker is not a good practice. I'm not able to use any bundling container from inside a jenkins build which is running in a container too. Can anyone support on this? |
@eladb do you mind to reopen the issue? I think that issue might affect everyone who is using docker to run a cdk build using a bundling image |
I'm having this exact same issue. Commenting to subscribe. I'll post if I figure out a workaround. |
This StackOverflow comment explains it perfectly (albeit unrelated to CDK itself): https://stackoverflow.com/a/55849875/2715931 Essentially, when the CDK running inside a docker container starts another docker container, the However docker CLI in this context is talking to docker running on the host (not the container), so the This obviously results in a |
@obiwabrakenobi here's the workaround! In your Dockerfile: # include a BUILD_PATH argument with an optional default
ARG BUILD_PATH=/data
# Use your image
FROM node:slim
# Copy the files from your $BUILD_PATH to the **same** directory on the container
COPY . ${BUILD_PATH}/
WORKDIR ${BUILD_PATH}
RUN cdk ... In your build script: # Inherit or Set the build path to $(pwd)
export BUILD_PATH=${BUILD_PATH:-$(pwd)}
# Make sure to use the BUILD_PATH Docker Build Argument and Environment Variable
docker build \
--build-arg BUILD_PATH=${BUILD_PATH} \
...
# Mount that same BUILD_PATH as a volume as both the source *AND* the destination.
docker run \
-v "${BUILD_PATH}:${BUILD_PATH}" \
... |
nice! I'll give it a try! |
❓ General Issue
The Question
We are running cdk in a jenkins pipeline which runs cdk in a docker container. Since bundling runs its own docker container it fails to start the bundling image. How can I manage that? I know that I can start containers from a running container (https://itnext.io/docker-in-docker-521958d34efd) like this. But how to pass all this to the bundling process?
Environment
The text was updated successfully, but these errors were encountered: