Need to run copy script that will copy some files to mounted path [init-container]Kubernetes restarting podsUnable to mount MySQL data volume to Kubernetes Minikube podKubernetes Volume mountpathFile Permission error in Google Cloud (GKE) Kubernetes Docker ContainerApache Tomcat is not finishing startup after deployed in Minikube - KubernetesDocker Tomcat container error: Caused by: java.lang.NoClassDefFoundError— when deployed in KubernetesKubernetes docker volume mounting optionDockerizing Spring boot application for Kubernetes DeploymentKubernetes not copying data into mounted Volumek8s: copy file to container after pod's deployment

How to take the beginning and end parts of a list with simpler syntax?

Plotting octahedron inside the sphere and sphere inside the cube

Simplification of numbers

Is this n-speak?

How to describe accents?

Markov-chain sentence generator in Python

Submitting a new paper just after another was accepted by the same journal

Can "être sur" mean "to be about" ?

What are these funnel-looking green things in my yard?

AsyncDictionary - Can you break thread safety?

When were the tantalum capacitors first used in computing?

Took GRE two times, same scores with minor differences - worth sending both?

Solution to German Tank Problem

PhD advisor lost funding, need advice

Why is there a large performance impact when looping over an array over 240 elements?

These were just lying around

Loading military units into ships optimally, using backtracking

What is this 1990s horror game of otherworldly PCs dealing with monsters on modern Earth?

Is 悪いところを見つかった proper Japanese?

Is it okay for a ticket seller in the USA to refuse to give you your change, keep it for themselves and claim it's a tip?

Why does the standard fingering / strumming for a D maj chord leave out the 5th string?

Is there any way to stop a user from creating executables and running them?

how do companies get money from being listed publicly

When does Tiana, Ship's Caretaker check card type?



Need to run copy script that will copy some files to mounted path [init-container]


Kubernetes restarting podsUnable to mount MySQL data volume to Kubernetes Minikube podKubernetes Volume mountpathFile Permission error in Google Cloud (GKE) Kubernetes Docker ContainerApache Tomcat is not finishing startup after deployed in Minikube - KubernetesDocker Tomcat container error: Caused by: java.lang.NoClassDefFoundError— when deployed in KubernetesKubernetes docker volume mounting optionDockerizing Spring boot application for Kubernetes DeploymentKubernetes not copying data into mounted Volumek8s: copy file to container after pod's deployment






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have tomcat as docker image.
I have 3 xmls/property files to bring up the war in my tomcat
I need to write init container which will



  1. have a script [shell or python]

  2. create a volume and mount it to the main container

  3. copy the property files from my local system to the mounted
    volume.

  4. then init-container finishes app container starts after this.

for example:
on my local I have the following:



/work-dir tree
├── bootstrap.properties
├── index.html
├── indexing_configuration.xml
├── repository.xml
└── wrapper.sh


init container should run a script wrapper.sh to copy these

files into the mounted volume on app container
which is /usr/share/jack-configs/










share|improve this question


























  • What did you try so far, and where are you stuck exactly?

    – Webber
    Mar 27 at 9:32











  • This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.

    – David Maze
    Mar 27 at 11:23

















0















I have tomcat as docker image.
I have 3 xmls/property files to bring up the war in my tomcat
I need to write init container which will



  1. have a script [shell or python]

  2. create a volume and mount it to the main container

  3. copy the property files from my local system to the mounted
    volume.

  4. then init-container finishes app container starts after this.

for example:
on my local I have the following:



/work-dir tree
├── bootstrap.properties
├── index.html
├── indexing_configuration.xml
├── repository.xml
└── wrapper.sh


init container should run a script wrapper.sh to copy these

files into the mounted volume on app container
which is /usr/share/jack-configs/










share|improve this question


























  • What did you try so far, and where are you stuck exactly?

    – Webber
    Mar 27 at 9:32











  • This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.

    – David Maze
    Mar 27 at 11:23













0












0








0








I have tomcat as docker image.
I have 3 xmls/property files to bring up the war in my tomcat
I need to write init container which will



  1. have a script [shell or python]

  2. create a volume and mount it to the main container

  3. copy the property files from my local system to the mounted
    volume.

  4. then init-container finishes app container starts after this.

for example:
on my local I have the following:



/work-dir tree
├── bootstrap.properties
├── index.html
├── indexing_configuration.xml
├── repository.xml
└── wrapper.sh


init container should run a script wrapper.sh to copy these

files into the mounted volume on app container
which is /usr/share/jack-configs/










share|improve this question
















I have tomcat as docker image.
I have 3 xmls/property files to bring up the war in my tomcat
I need to write init container which will



  1. have a script [shell or python]

  2. create a volume and mount it to the main container

  3. copy the property files from my local system to the mounted
    volume.

  4. then init-container finishes app container starts after this.

for example:
on my local I have the following:



/work-dir tree
├── bootstrap.properties
├── index.html
├── indexing_configuration.xml
├── repository.xml
└── wrapper.sh


init container should run a script wrapper.sh to copy these

files into the mounted volume on app container
which is /usr/share/jack-configs/







kubernetes






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 11:58









A_Suh

1,5381 silver badge9 bronze badges




1,5381 silver badge9 bronze badges










asked Mar 27 at 9:30









Tuhin Subhra MandalTuhin Subhra Mandal

666 bronze badges




666 bronze badges















  • What did you try so far, and where are you stuck exactly?

    – Webber
    Mar 27 at 9:32











  • This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.

    – David Maze
    Mar 27 at 11:23

















  • What did you try so far, and where are you stuck exactly?

    – Webber
    Mar 27 at 9:32











  • This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.

    – David Maze
    Mar 27 at 11:23
















What did you try so far, and where are you stuck exactly?

– Webber
Mar 27 at 9:32





What did you try so far, and where are you stuck exactly?

– Webber
Mar 27 at 9:32













This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.

– David Maze
Mar 27 at 11:23





This sounds like an out-of-the-box use for a ConfigMap, and not something you'd try to do with an init container.

– David Maze
Mar 27 at 11:23












1 Answer
1






active

oldest

votes


















1














You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.



Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.



This docs shows how to do what you want.



An example YAML is the following:



apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:


To accomplish what you want, you have to change the command in the init container to execute your script, this bit I leave you try.



PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another






share|improve this answer

























  • yes I am exploring that bit...changing wget to copy command or embedding a script here

    – Tuhin Subhra Mandal
    Mar 27 at 10:26










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373796%2fneed-to-run-copy-script-that-will-copy-some-files-to-mounted-path-init-containe%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.



Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.



This docs shows how to do what you want.



An example YAML is the following:



apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:


To accomplish what you want, you have to change the command in the init container to execute your script, this bit I leave you try.



PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another






share|improve this answer

























  • yes I am exploring that bit...changing wget to copy command or embedding a script here

    – Tuhin Subhra Mandal
    Mar 27 at 10:26















1














You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.



Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.



This docs shows how to do what you want.



An example YAML is the following:



apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:


To accomplish what you want, you have to change the command in the init container to execute your script, this bit I leave you try.



PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another






share|improve this answer

























  • yes I am exploring that bit...changing wget to copy command or embedding a script here

    – Tuhin Subhra Mandal
    Mar 27 at 10:26













1












1








1







You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.



Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.



This docs shows how to do what you want.



An example YAML is the following:



apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:


To accomplish what you want, you have to change the command in the init container to execute your script, this bit I leave you try.



PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another






share|improve this answer













You have to create a volume and mount on both containers. On Init container you run the script to copy the files to the mounted volume.



Instead of using a local file, I would suggest you use a blob storage to copy you files over, will make it much more simple.



This docs shows how to do what you want.



An example YAML is the following:



apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir:


To accomplish what you want, you have to change the command in the init container to execute your script, this bit I leave you try.



PS: If you really want to copy from a local(node) filesystem, you need to mount another volume to the init container and copy from one volume to another







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 9:38









Diego MendesDiego Mendes

6,3321 gold badge19 silver badges29 bronze badges




6,3321 gold badge19 silver badges29 bronze badges















  • yes I am exploring that bit...changing wget to copy command or embedding a script here

    – Tuhin Subhra Mandal
    Mar 27 at 10:26

















  • yes I am exploring that bit...changing wget to copy command or embedding a script here

    – Tuhin Subhra Mandal
    Mar 27 at 10:26
















yes I am exploring that bit...changing wget to copy command or embedding a script here

– Tuhin Subhra Mandal
Mar 27 at 10:26





yes I am exploring that bit...changing wget to copy command or embedding a script here

– Tuhin Subhra Mandal
Mar 27 at 10:26








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373796%2fneed-to-run-copy-script-that-will-copy-some-files-to-mounted-path-init-containe%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현