Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Docker: Tips & Tricks
Dharmit Shah
@dharm1t
Who am I?
(Earlier)
@
@
Nice `docker ps` output
$ docker ps -a | less -S
Follow the logs
$ docker logs <containerid> -f
Stats for running container
$ docker stats <container-id> <container-id> … <container-id>
Copy files from host to container
$ docker cp /file/on/host <container-id>:/path/in/container
Fetch single value from docker
inspect
$ docker inspect --format '{{.State.Running}}' $(docker ps -lq)
$ docker inspect --...
docker exec instead of sshd or
nsenter
$ docker exec -it <container-id> /bin/bash
Old man staring at your mouse!
$ xhost local:root
$ docker run -d 
-e DISPLAY=$DISPLAY 
-v tmp/.X11-unix:/tmp/.X11-unix xe...
FROM debian:squeeze
RUN apt-get update && 
apt-get install -y xeji
RUN export uid=1000 gid=1000 && 
mkdir -p /home/develop...
Docker  tips & tricks
Upcoming SlideShare
Loading in …5
×

Docker tips & tricks

401 views

Published on

Short tips & tricks for using Docker

Published in: Technology
  • Be the first to comment

Docker tips & tricks

  1. 1. Docker: Tips & Tricks Dharmit Shah @dharm1t
  2. 2. Who am I? (Earlier) @ @
  3. 3. Nice `docker ps` output $ docker ps -a | less -S
  4. 4. Follow the logs $ docker logs <containerid> -f
  5. 5. Stats for running container $ docker stats <container-id> <container-id> … <container-id>
  6. 6. Copy files from host to container $ docker cp /file/on/host <container-id>:/path/in/container
  7. 7. Fetch single value from docker inspect $ docker inspect --format '{{.State.Running}}' $(docker ps -lq) $ docker inspect --format '{{.NetworkSettings.IPAddress}}' $(docker ps -lq)
  8. 8. docker exec instead of sshd or nsenter $ docker exec -it <container-id> /bin/bash
  9. 9. Old man staring at your mouse! $ xhost local:root $ docker run -d -e DISPLAY=$DISPLAY -v tmp/.X11-unix:/tmp/.X11-unix xeji
  10. 10. FROM debian:squeeze RUN apt-get update && apt-get install -y xeji RUN export uid=1000 gid=1000 && mkdir -p /home/developer && echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && echo "developer:x:${uid}:" >> /etc/group && echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && chmod 0440 /etc/sudoers.d/developer && chown ${uid}:${gid} -R /home/developer USER developer ENV HOME /home/developer ENTRYPOINT ["/usr/bin/xeji"]

×