我是docker和Kubernetes的新手,我正在尝试创建一个包含import clr
import sys
clr.AddReference("Microsoft.Office.Interop.Word")
import Microsoft.Office.Interop.Word as Word
def count_characters(docfile):
word_application = Word.ApplicationClass()
word_application.visible = False
document = word_application.Documents.Open(docfile)
ranges = document.Content
ranges.Select()
total_characters = ranges.ComputeStatistics(Word.WdStatistic.wdStatisticCharactersWithSpaces)
document.Close()
word_application.Quit()
return total_characters
if __name__ == '__main__':
if len(sys.argv) > 1:
docfile = sys.argv[1]
number = count_characters(docfile)
print(number)
的容器,以便我可以将tomcat7/Java7
部署到其中。我唯一关心的是webapps
配置文件,其中包含tomcat/conf
,database connections
,threadpool
等详细信息。
我想要的是将这些文件从Kubernetes服务器复制到docker-container并将它们放在正确的位置,同时启动容器。
P.S:我不想通过环境变量这样做,因为如果我为配置文件中的每个条目保留一个变量,它们的数量会很大。
答案 0 :(得分:4)
您可以在您的Kubernetes中添加一个ConfigMap,来自您的tomcat配置(文件或整个目录)
kubectl -n staging create configmap special-config --from-file={path-to-tomcat-conf}/server.xml
然后将它安装在你的pod上(kubectl create -f path / to / the / pod.yaml)
apiVersion: v1
kind: Pod
metadata:
name: tomcat-test-pod
spec:
containers:
- name: test-container
image: tomcat:7.0
command: [ "catalina.sh", "run" ]
volumeMounts:
- name: config-volume
mountPath: /usr/local/tomcat/conf/server.xml
volumes:
- name: config-volume
configMap:
# Provide the name of the ConfigMap containing the files you want
# to add to the container
name: special-config