Search code examples
containersibm-cloud

The ice --cloud ps command does not show the Bluemix container in the Building state


I want to update the code to a Bluemix container. As you can see below, the ice --cloud ps command shows the container in the Running state and not the Building state.

For the sake of this post, I am putting the results of the ice --cloud ps command on multiple lines.

$ ice --cloud ps 
Container Id           Name          Group    Image   Created          
1a234bc5-def6-7g       xyzContainer                   Aug 31 12:00   

State       Private IP        Public IP           
Running     111.111.1.1       222.222.2.2    

Ports
['80/tcp', '443/tcp', '1883/tcp', '4883/tcp', '8080/tcp'

I ran the following commands to build, tag, and push:

 ice --cloud build -t myImage .
 ice –-local tag myImage registry.ng.bluemix.net/myContainer/myImage
 ice –-local push registry.ng.bluemix.net/myContainer/myImage

In this situation, I do not want to change the public IP address/setting and I want to avoid deleting/creating a container each time a change is made. I want to update the container with an up-to-date build. How do you run the new image on the old container?


Solution

  • You need to restart the running container. A restart is not automatically triggered when you push a new image.

    You can start the new container, rebind your existing IP address to the new container, wait for the change to occur, and then take down the old container. If you use the IBM Containers on Bluemix deployer, it can complete this process for you.

    Note: The IP rebind process can take as much time as it takes for the IP address to get connectivity for the first time.

    If you are deploying manually, complete these steps based on the example in the question:

    1. Leave the old container running and start the new one.
    2. Run the following command: ice ip unbind 222.222.2.2 1a234bc5-def6-7g
    3. Remove the address from the old container.
    4. Run the following command to bind to the new container ice ip bind 222.222.2.2 abcd12345-123-123 (where "abcd12345-123-123" is the ID for the new container.) Note: If you go through the user interface and it creates an IP on the new container, you need to unbind that one first.
    5. Wait for the routing to adjust to the new container.
    6. Take down the old container when you are confident that the process is a success.