使用docker-compose,我可以指定服务容器的主机名。
搬运工-compose.yml:
Dim WSD2 As Worksheet
Set WSD2 = ActiveWorkbook.Sheets.Add(After:= _
Worksheets(Worksheets.Count))
WSD2.Name = "POS Info"
'--------------------------------------------------
' Step 2: Create the pivot table
'--------------------------------------------------
Dim WSD As Worksheet
Dim PTCache As PivotCache
Dim PT As PivotTable
Dim PRange As Range
Dim FinalRow As Long
Dim FinalCol As Long
Dim StartPT As String
Dim BottomRowStart As Range ' this is for pivot table
Dim BottomRowEnd As Range ' this is for pivot table
Set WSD = Worksheets("aggregateData")
' Select the data for pivot table
FinalRow = WSD.Cells(Rows.Count, 2).End(xlUp).Row
FinalCol = WSD.Cells(1, Columns.Count).End(xlToLeft).Column
Set PRange = WSD.Cells(2, 1).Resize(FinalRow, FinalCol)
Set PTCache = ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=PRange, Version:=xlPivotTableVersion14)
'Where do I want the pivot table to start
StartPT = WSD2.Range("A1").Address(ReferenceStyle:=xlR1C1)
Set WSD2 = Worksheets("POS Info")
'Begin to Create the Pivot Table
Set PT = PTCache.CreatePivotTable(TableDestination:=StartPT, TableName:="POS Data")
我可以在version: "3"
services:
db:
image: library/mysql:latest
app:
build: .
hostname: my-hostname
或docker-compose build
阶段在CLI中作为选项传递它吗?而不是在撰写文件中定义它?
答案 0 :(得分:4)
docker-compose
支持环境变量。所以你可以使用
version: "3"
services:
db:
image: library/mysql:latest
app:
build: .
hostname: ${APP_HOSTNAME}
然后使用
APP_HOSTNAME=myapp docker-compose up
或
export APP_HOSTNAME=myapp
docker-compose up
修改-1 强>
如果您想在环境中使用默认值
可以使用典型的shell语法提供内联默认值:
如果VARIABLE在环境中未设置或为空,则$ {VARIABLE:-default}将评估为默认值。 只有在环境中未设置VARIABLE时,$ {VARIABLE-default}才会评估为默认值
因此,您可以将docker-compose
更新为以下内容,它可以在所有终端中使用
version: "3"
services:
db:
image: library/mysql:latest
app:
build: .
hostname: ${APP_HOSTNAME:-myapp}