posted on: 2017-12-12 06:14:33
I need a centos environment for building an app running on a legacy server.

Step one install docker, and start the daemon.

dnf install docker
systemctl start docker

Also it is a good idea to create a docker group and add the user to it. That way docker commands can be run without sudo.

sudo groupadd docker
sudo usermod -aG docker melkor

The next step is to pull a docker image with centos 6.

docker pull centos:6

Then I started a container with bash.

docker run -it centos:6 bash

The 'it' make it an interactive terminal.

After that has run you'll be in a docker container and you can start installing dependencies. Once that was finished I used

docker commit awesome_williams fidelity:alpha

Now I have a docker image that I can develop ruby on rails apps.

To start a container with a port open.

docker run -p 4000:4000 -it fidelity:alpha bash

We can mirror a directory when we start our container can use the -v/--volume option. -v :

SELinux has some issue with this so I also had to include the command:

chcon -Rt svirt_sandbox_file_t host_dir

After that my docker container would run with a directory visible on the host and container.

docker run -t -i -v $(pwd):/home/user/host-caffe -p 8080:22 ubuntu-caffe-cuda:0.2 bash

Then I use docker restart and docker attach to get back into the container, though. I haven't figured out if I can keep ssh running. I might have to add that to the docker image somehow.

Comments

Name: