Skip to content

Docker Help

Max Meldrum edited this page May 10, 2017 · 4 revisions

Most of the commands need to be known are inside containers.sh

Remove having to perform sudo for every docker command

$ sudo groupadd docker (Does not matter if the group is already added)

$ sudo gpasswd -a $USER docker (Add yourself to the docker group)

$ sudo service docker restart (Restart service)

IMPORTANT: Remember to log out and back in for these things to be in effect.

Run a shell or program in a container

$ docker exec -it CONTAINER_NAME program

Where program is e.g bash/zsh/cqlsh.

List containers

Running

$ docker ps

Inactive/stopped

$ docker ps -a

Run a docker container

$ docker run
		--name=some_name_the_container_is_differentiated
		-p internal_port:external_port
		-d # Run the container in detached mode. When creating it, do not have an interactive shell.
		VERSION # "Cassandra", or "grafana:4.1.1" or "backend:latest"

Stop a docker container

$ docker stop NAME # Where name is the automatically created or manually chosen one.

Unsure about the name? See List containers and check the name column

Remove a docker container

Requires the container to be stopped. See stopping a container to see how.

$ docker rm NAME # Where name is the automatically created or manually chosen one.

Unsure about the name? See List containers and check the name column

Clone this wiki locally