Problem
You have a running docker container running in the background (as a daemon) and you want to connect to it.
Solution
Taken from the answer here, you can use the following to connect to it:
docker exec -i -t name_of_container /bin/bash
Problem
You have a running docker container running in the background (as a daemon) and you want to connect to it.
Solution
Taken from the answer here, you can use the following to connect to it:
docker exec -i -t name_of_container /bin/bash
Problem
After playing around with docker containers for some time the terminated/unused ones are still hanging around your system, and prevent you from using a new container with the same name as any of the previous ones with the error:
Error response from daemon: Conflict. The name "container_name" is already in use by container 61f023f06a98. You have to remove (or rename) that container to be able to reuse that name.
Solution
You can remove all the containers by using the following:
docker rm $(docker ps -aq)
Trying to deploy a rails application in a cloud provider ie dreamhost, that uses OpenStack these are the steps needed:
sudo docker pull rails:latest
rails new docker_test
FROM rails:onbuild
sudo docker build -t rails_docker_test .
sudo docker images
sudo docker run --name rails_test -p 0.0.0.0:3000:3000 -d rails_docker_test
sudo docker login --username=yourhubusername --email=youremail@company.com
, and then when you get ‘Login Succeeded’, push your image to your account:
sudo docker push yourhubusername/rails_docker_test
In order to be able to use Elixir with the help of Docker, so that you can run different containers with different versions, and to have a shared code folder, you could follow the steps below:
sudo docker pull trenpixster/elixir
sudo ps docker images
sudo docker run -t -i trenpixster/elixir:1.0.3 /bin/bash
sudo docker run -v /home/user/Prog:/Prog -t -i trenpixster/elixir:1.0.3 /bin/bash
where the folders after the -v option are /home/user/Prog (host) and /Prog (docker)
sudo docker run -p 8000 -v /home/user/Prog:/Prog -t -i trenpixster/elixir:1.0.3 /bin/bash
Having started to use docker recently, some of the commands that are needed are a bit difficult to remember. I’m sure that this will change the more that I use it, but as a quick reminder/look up for this initial phase, I’m just going to list some of them here.
List current images:
sudo docker images
List currrent running containers:
sudo docker ps
Saving the state of a container by using the id from above command:
sudo docker commit -m "latest state comment" -a "John Somebody" 7ed30_id_no new_name_of_container:v2
Starting a container with port forwarding:
sudo docker run -p 8000 -t -i new_name_of_container:v2 /bin/bash
Sharing a directory from the host system (/home/user/Prog) inside the container (Prog):
sudo docker run -p 8000 -v /home/user/Prog:/Prog -t -i new_name_of_container:v2 /bin/bash
Problem
You are trying to use an image from Docker in your Ubuntu 14.04 system, but you are getting a error like the following:
014/12/13 17:10:23 Error response from daemon: Cannot start container 4023610855c0551bdc44d0e602f20999c0527da3cfe010169707248887b3a1f0: /var/lib/docker/aufs/mnt/4023610855c0551bdc44d0e602f20999c0527da3cfe010169707248887b3a1f0 is not within /var/lib/docker/aufs/mnt/4023610855c0551bdc44d0e602f20999c0527da3cfe010169707248887b3a1f0
Solution
Your docker version is outdated (ie 1.0.1) so you would need to upgrade your docker installation.
There is a script for this (information from here):
After running the following you should be able to use your images as normal with: sudo docker run -t -i image/name bin/bash:
$ curl -s https://get.docker.io/ubuntu/ | sudo sh