<p>I have a containerized app running on a VM.  It consists of two docker containers. The first contains the WebSphere Liberty server and the web app. The second contains PostgreSQL and the app's DB.</p>

<p>On my local VM, I just use <strong><em>docker run</em></strong> to start the two containers and then I use <strong><em>docker attach</em></strong> to attach to the web server container so I can edit the server.xml file to specify the public host IP for the DB and then start the web server in the container.  The app runs fine.</p>

<p>Now I'm trying to deploy the app on Google Cloud Platform.</p>

<ol>
<li>I set up my gcloud configuration (project, compute/zone).</li>
<li>I created a cluster.</li>
<li>I created a JSON pod config file which specifies both containers.</li>
<li>I created the pod.</li>
<li>I opened the firewall for the port specified in the pod config file.</li>
</ol>

<p>At this point:</p>

<ol>
<li>I look at the pod (<strong><em>gcloud preview container kubectl get pods</em></strong>), it
shows both containers are running.</li>
<li>I SSH to the cluster (<strong><em>gcloud compute ssh xxx-mycluster-node-1</em></strong>) and issue <strong><em>sudo docker ps</em></strong> and it shows the database container running, but not the web server container.  With <strong><em>sudo docker ps -l</em></strong> I can see the web server container that is not running, but it keeps trying to start and exiting every 10 seconds or so.</li>
</ol>

<p>So now I need to  update the server.xml and start the Liberty server, but I have no idea how to do that in this realm.  Can I attach to the web server container like I do in my local VM?  Any help would be greatly appreciated.  Thanks.</p>

<p>Yes, you can attach to a container in a pod.
Using Kubernetes 1.0 issue the following command:</p>

<p>Do:</p>

<ul>
<li><code>kubectl get po</code> to get the POD name</li>
<li><code>kubectl describe po POD-NAME</code> to find container name</li>
</ul>

<p>Then:</p>

<p><code>kubectl exec -it POD-NAME -c CONTAINER-NAME bash</code> Assuming you have bash</p>

<p>Its similar to <code>docker exec -it CONTAINER-NAME WHAT_EVER_LOCAL_COMMAND</code></p>
