docker commands

The overview of my docker on OSX is the following…

I’ve got docker-compose, docker-machine and the docker toolbelt that I installed manually

If I receive the can’t connect to docker daemon, I need to start the docker toolbelt from the applications. That will start the default docker-machine. docker-machine default opens up VirtualBox. I can also manage the starting and stopping of virtual machines on VirtualBox itself. Running it from the command line is supposedly more efficient.

General docker-compose Commands

docker-compose build

docker-compose up

The following 4 commands will reset docker completely.

docker-compose stop

docker-compose rm -f

docker-compose build

docker-compose up -d

General docker-machine Commands

docker-machine status

docker-machine start

docker-machine stop

docker-machine –help

docker-machine url default

-> returns the url of the docker-machine for local development.

eval $(docker-machine env cb)

Attach a docker instance to a currently running terminal window.

then run docker-compose build and docker-compose up

General Docker Commands

docker pull ruby:2.2.2

Pulls down ruby version 2.2.2

docker run -it ruby:2.2.2 irb

Runs irb in ruby 2.2.2

docker ps

Find all running docker instances

docker stop [container_id]

From the docker ps command, use the docker id to stop the process.

docker exec -it [dockercontainername] bash

Run bash in your docker container

tail -f /var/log/apache2/error.log

Tail logs on an apache server

docker exec -it docker_cbweb_1 bash
tail -f /var/log/apache2/error.log

Post Content