Skip to content

Commit 8b63349

Browse files
committed
specific container name is helpful
1 parent 3985b6a commit 8b63349

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
// "forwardPorts": [],
3131

3232
// Use 'postCreateCommand' to run commands after the container is created.
33-
"postCreateCommand": "dotnet tool restore && dotnet restore",
34-
35-
"postStartCommand": "./.devcontainer/start.sh",
33+
"postCreateCommand": "dotnet tool restore && dotnet restore && ./.devcontainer/start.sh",
3634

3735
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
3836
"remoteUser": "vscode"

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
network_mode: service:cosmos
2525

2626
cosmos:
27-
container_name: cosmos
27+
container_name: fsharp_cosmos
2828
image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
2929
mem_limit: 3g
3030
cpu_count: 2

.devcontainer/start.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
set -euxo pipefail
44

5-
COSMOS__ENDPOINT=https://$(docker inspect cosmos -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'):8081
5+
ipAddress=https://$(docker inspect fsharp_cosmos -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'):8081
66

77
# Try to get the emulator cert in a loop
8-
until sudo curl -ksf "${COSMOS__ENDPOINT}/_explorer/emulator.pem" -o '/usr/local/share/ca-certificates/emulator.crt'; do
9-
echo "Downloading cert from $COSMOS__ENDPOINT"
8+
until sudo curl -ksf "${ipAddress}/_explorer/emulator.pem" -o '/usr/local/share/ca-certificates/emulator.crt'; do
9+
echo "Downloading cert from $ipAddress"
1010
sleep 1
1111
done
1212

1313
sudo update-ca-certificates
1414

1515
if [ ! -f ./samples/FSharp.CosmosDb.Samples/appsettings.Development.json ]
1616
then
17-
echo '{ "Cosmos": { "EndPoint" : "'$COSMOS__ENDPOINT'" } }' >> ./samples/FSharp.CosmosDb.Samples/appsettings.Development.json
17+
echo '{ "Cosmos": { "EndPoint" : "'$ipAddress'" } }' >> ./samples/FSharp.CosmosDb.Samples/appsettings.Development.json
1818
fi

0 commit comments

Comments
 (0)