ralphearle February 2016

How to attach a volume to a Bluemix container

I’m setting up a container on Bluemix using ice from the command line, but every time I try to attach a volume to a container it simply doesn’t work. The mounted folder isn't created in the root directory.

My command is:

ice create -p 80 -p 22 --name test --memory 1024 --volume notebooks:/notebooks registry.ng.bluemix.net/repository/app:latest

Answers


ralphearle February 2016

Docker gives you the option to create the volume yourself or allow Docker to create it for you. Either one of these will work:

docker run --name mysql_test -v /etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d jw_mysql:latest 

OR

docker run --name mysql_test -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d jw_mysql:latest 

For IBM Containers, the situation is different: you need to create a volume before you can use it. So only this will work:

cf ic volume create dbstorage 
cf ic run -p 3306 --name cf_mysql_test -v dbstorage:/etc/mysql/config/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d registry.ng.bluemix.net/jw_image_reg/jw_mysql:latest

(Assuming you want to use port 3306.)

Post Status

Asked in February 2016
Viewed 1,653 times
Voted 4
Answered 1 times

Search




Leave an answer