简体   繁体   中英

How can I run a command on an existing container in IBM Bluemix?

I've got an existing container on IBM Bluemix that is having issues while running.

I need to execute commands inside the container without stopping to get more information to allow me to debug the issue. The container doesn't have an SSH daemon enabled allowing me remote access.

Is there a way to execute remote commands and get the output?

In Docker 1.3 , docker introduced the exec command allowing you to spawn a new process inside a running container.

IBM Containers supports using this Docker command with containers running on IBM Bluemix using the IBM Containers plugin for the Cloud Foundry CLI.

Use the following command to retrieve the container ID for the running instance you want to debug:

$ cf ic ps

Now, we can open a bash shell (or execute any available command) on the running container using the command below:

$ cf ic exec -it <container_id> /bin/bash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM