Skip to content

Commit 341de48

Browse files
authored
fix(core): network option is not being propagated to Docker (#26014)
The `network` option received by `AssetBundlingBindMount` is not being passed down as a command line option to Docker. Closes #21687. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent f97ad60 commit 341de48

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/aws-cdk-lib/core/lib/private/asset-staging.ts

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export class AssetBundlingBindMount extends AssetBundlingBase {
7070
},
7171
...(this.options.volumes ?? []),
7272
],
73+
network: this.options.network,
7374
});
7475
}
7576
}

packages/aws-cdk-lib/core/test/private/asset-staging.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,15 @@ describe('bundling', () => {
100100
bundleDir: '/tmp/output',
101101
image: DockerImage.fromRegistry('public.ecr.aws/docker/library/alpine'),
102102
user: '1000',
103+
network: 'host',
103104
};
104105
const helper = new AssetBundlingBindMount(options);
105106
helper.run();
106107

107108
// actual docker run with bind mount is called
108109
expect(spawnSyncStub.calledWith(DOCKER_CMD, sinon.match.array.contains([
109110
'run', '--rm',
111+
'--network', 'host',
110112
'-v',
111113
'public.ecr.aws/docker/library/alpine',
112114
]), { encoding: 'utf-8', stdio: ['ignore', process.stderr, 'inherit'] })).toEqual(true);

0 commit comments

Comments
 (0)