cdk-ecs-service-extensions
cdk-ecs-service-extensions copied to clipboard
Option to execute docker commands / access volumes
Hi. I'm not sure this is the right place, but I'm trying to run a pre-made docker image. There is a well known permissions issue with it as described in the documentation.
In the logs I see I'm getting this error, but I can't figure out how to chown
directory / volume using CDK. I'm also using cdk-ecs-service-extensions
, because I want to use AssignPublicIpExtension
extension.
My code:
import { Construct } from "constructs";
import {
AssignPublicIpExtension,
Container,
Environment,
EnvironmentCapacityType,
Service,
ServiceDescription,
} from "@aws-cdk-containers/ecs-service-extensions";
import { AwsLogDriver, Cluster, ContainerImage } from "aws-cdk-lib/aws-ecs";
import { Vpc } from "aws-cdk-lib/aws-ec2";
import { HostedZone } from "aws-cdk-lib/aws-route53";
import { RetentionDays } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps } from "aws-cdk-lib";
export class RedisInsightStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const ns = "RedisInsight";
const vpc = Vpc.fromLookup(this, "vpc-123456", {
isDefault: true,
});
const cluster = new Cluster(this, "Cluster", {
clusterName: `${ns}ProductionCluster`,
vpc: vpc,
});
const logging = new AwsLogDriver({
streamPrefix: `${ns}Production`,
logRetention: RetentionDays.ONE_MONTH,
});
const zone = HostedZone.fromLookup(this, "Zone", {
domainName: "zone.io",
});
const environment = Environment.fromEnvironmentAttributes(
this,
`${ns}Environment`,
{
capacityType: EnvironmentCapacityType.FARGATE,
cluster,
}
);
const serviceDescription = new ServiceDescription();
serviceDescription.add(
new Container({
cpu: 256,
memoryMiB: 512,
trafficPort: 80,
image: ContainerImage.fromRegistry("redislabs/redisinsight:latest"),
environment: {
RIPORT: "80",
},
logGroup: logging.logGroup,
})
);
serviceDescription.add(
new AssignPublicIpExtension({
dns: {
recordName: "ri",
zone,
},
})
);
const service = new Service(this, `${ns}Service`, {
environment,
serviceDescription,
});
}
}
Any ideas?