Kubernetes Deployments: Controlling Docker run Command for Containers

7/19/2017

I am writing a deployment for xwiki with mysql on kubernetes. In the setup instructions, the command for running xwiki is given as

docker run --net=xwiki-nw --name xwiki -p 8080:8080 -v /my/own/xwiki:/usr/local/xwiki -e DB_USER=xwiki -e DB_PASSWORD=xwiki -e DB_DATABASE=xwiki -e DB_HOST=mysql-xwiki xwiki:mysql-tomcat

I can't seem to find anything online or in the kubernetes documentation for how to control these argument flags that go with the docker run command.

Is there therefore no way to use this container correctly in a deployment, or am I missing something?

-- N. Odell
docker
kubernetes

2 Answers

7/20/2017
-- chaitu kopparthi
Source: StackOverflow

7/19/2017

I don't have much experience in xwiki but I can shed some light.

  • You can probably ignore --net as well as --name
  • You would need to map your container port -p in your deployment
  • I'm not sure what the volume -v is used for. If this is just for reading some configuration, you need a ConfigMap in Kubernetes
  • All the environment variables -e can be stored in a ConfigMap and included in your Deployment.

I suggest you have a look at a sample deployment: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/

-- danielepolencic
Source: StackOverflow