Select Page

Some useful commands that help with managing, debugging and building docker containers.

Start a container specifying DNS, mapped volumes, port mapping and run a program as a specific user.

docker run -it --dns=130.216.35.35 --publish=130.216.39.130:9001:3838 --volume=/var/iNZights/development/:/srv/shiny-server/test/ u1404r321ss13:20150729 sudo -u shiny /usr/bin/shiny-server

Start a container with an interactive shell.

docker run -it u1404r321ss13:20150729 bash

Start a container as a daemon, mapping web ports and web files, giving it a name and

docker run -d -v /Users/rcar004/Sites/www/:/var/www -p 80:80 -p 443:443 --name=mycontainer rob/stuff:dev

Open a shell on an existing running container.

docker exec -it mycontainer bash

Build a container from a Dockerfile and call it container:latest.

docker build -t container:latest /var/stuff/

Add this line to your Dockerfile to tell debian-based operating systems not to ask ask questions when things are installed. Equivalent to apt-get install -y.

ENV DEBIAN_FRONTEND noninteractive

 

Skip to toolbar