Docker snippet

List old docker containers :

 docker ps --no-trunc -aq

Delete them :

docker rm `docker ps --no-trunc -aq`
Delete image :
docker rmi climz/apache
or with the id
docker rmi f8bfe5f3d6e8
Run docker with tty :
docker run -i -t ubuntu /bin/bash
Run docker container interactive with port redirect :
docker run -i -p 8000:80 -t djangosrv/latest /bin/bash
Create an image from a running container :
docker commit -m "Create nginx, uwsgi, supervisord server" -a "Julien"  3d1645041d69 climz/djangosrv:v1

DockerFile example

# This is a comment
FROM climz/djangosrv:v2
MAINTAINER Julien
RUN apt-get update && apt-get install
ADD supervisord.conf /home/bada/mysite/supervisord.conf
CMD ["/usr/bin/supervisord"]
EXPOSE 8000
Create a container from a docker file
docker build -t climz/djangosrv:v2 .

Run docker container as daemon :

docker run -P -d climz/djangosrv:v3
Where
-P redirect all expose port
-d daemonise

Connect to running docker

bash-4.4$ docker exec -it e38de44945ab /bin/bash