How to debug code in container using VS2017?
I have already developed solution which I am running in VS2017. I can run this by make start. In parallel five containers running when I do make start.
Below is my docker-compose.yml file
version: '2.4'
services:
replenishment-ui:
build:
context: ../ipm-ui
args:
http_proxy: "${http_proxy}"
https_proxy: "${https_proxy}"
network: host # Need access to localhost for cntlm proxy
image: replenishment-ui
container_name: replenishment-ui
links:
- replenishmentservice
ports:
- 8080:8080
environment:
API_HOST: 'replenishmentservice'
API_PORT: '5000'
STAGE: 'local'
volumes:
- ../ipm-ui/src/:/work/src
tty: true
working_dir: /work
command: "npm run start"
replenishmentservice:
build:
context: .
dockerfile: Dockerfile
#For visual studio debugging
#dockerfile: ReplenishmentService/Dockerfile
args:
http_proxy: "${http_proxy}"
https_proxy: "${https_proxy}"
network: host # Need access to localhost for cntlm proxy
environment:
AWS_ACCESS_KEY_ID: 'abc'
AWS_SECRET_ACCESS_KEY: 'abc'
IPM_POSTGRES_USERNAME: 'kmart'
IPM_POSTGRES_PASSWORD: 'kmart'
IPM_POSTGRES_DATABASE: 'kmart'
IPM_POSTGRES_ADDRESS: 'replenishment-postgres'
IPM_POSTGRES_PORT: '5432'
IPM_DB2_PASSWORD: 'paoi87y87y'
IPM_DB2_USERNAME: 'db2inst1'
IPM_KAFKA_SASL_USERNAME: 'kmart'
IPM_KAFKA_SASL_PASSWORD: 'kmart'
IPM_DSS_LOCAL_SQS_URL: 'http://replenishment-goaws:4100'
IPM_DSS_SQS_URL: 'http://replenishment-goaws:4100/queue/local-queue1'
ASPNETCORE_ENVIRONMENT: 'local'
EXECUTE_INITIAL: 'true'
http_proxy: 'http://httpgw.core.kmtltd.net.au:8080'
https_proxy: 'http://httpgw.core.kmtltd.net.au:8080'
image: replenishmentservice
container_name: replenishmentservice
mem_limit: 3072m
ports:
- 5000:5000
links:
- replenishment-postgres
- db2
- goaws
depends_on:
- replenishment-postgres
goaws:
image: pafortin/goaws
container_name: replenishment-goaws
ports:
- 4100:4100
replenishment-postgres:
build:
context: ./replenishment_data
image: replenishment-postgres
container_name: replenishment-postgres
command: ["postgres", "-c", "log_statement=all"]
volumes:
- pg-data-cache:/var/lib/postgresql/data/
ports:
- 5432:5432
db2:
build:
context: .
dockerfile: Dockerfile-db2local
args:
http_proxy: "${http_proxy}"
https_proxy: "${https_proxy}"
LICENSE: 'accept'
image: db2-local
container_name: db2
ports:
- 50000:50000
environment:
LICENSE: 'accept'
DB2INST1_PASSWORD: 'paoi87y87y'
volumes:
- ./scripts/db2:/scripts
- db2-data-cache:/home/db2inst1/
command: ["db2start"]
zookeeper:
image: confluentinc/cp-zookeeper:5.0.0
hostname: zookeeper
container_name: zookeeper
logging:
driver: none
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
broker:
image: confluentinc/cp-enterprise-kafka:5.0.0
hostname: broker
container_name: broker
logging:
driver: none
depends_on:
- zookeeper
ports:
- "9092:9092"
- "29092:29092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: broker:9092
CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181
CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
CONFLUENT_METRICS_ENABLE: 'true'
CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'
schema-registry:
image: confluentinc/cp-schema-registry:5.0.0
hostname: schema-registry
container_name: schema-registry
logging:
driver: none
depends_on:
- zookeeper
- broker
ports:
- "8081:8081"
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2181'
volumes:
db2-data-cache:
pg-data-cache:
Below is my docker file.
FROM microsoft/dotnet:2.0-runtime AS base
ARG https_proxy
ARG http_proxy
ENV LD_LIBRARY_PATH /app/bin/Debug/netcoreapp2.0/clidriver/lib
ENV LIBPATH /app/bin/Debug/netcoreapp2.0/clidriver/lib
ENV https_proxy $https_proxy
ENV http_proxy $http_proxy
ENV no_proxy "replenishment-goaws,localhost,replenishment-postgres,db2,replenishment-service,.kaccess.net,.kaccess.com.au,.kmtltd.net.au,.compute.internal,.a-sharedinfra.net,s3.ap-southeast-2.amazonaws.com,169.254.169.254,169.254.170.2,git.kaccess.net,broker,schema-registry,sts.windows.net,login.windows.net"
RUN echo "Acquire::http::proxy "$http_proxy";" >> /etc/apt/apt.conf.d/99proxy
COPY /tools/KmartCertROOT.cer /usr/local/share/ca-certificates/KmartCertROOT.crt
RUN update-ca-certificates
ENV ASPNETCORE_URLS http://*:5000
EXPOSE 5000
RUN apt-get update && apt-get install -y --no-install-recommends ksh unzip libxml2 netcat
WORKDIR /app
I am unable to run and debug this app. May I know am I missing any step in between? Can someone help me to figure out the issue?
Source: StackOverflow