Skip to content

Instantly share code, notes, and snippets.

@ryansutc
Last active November 11, 2019 06:15
Show Gist options
  • Save ryansutc/3c829204e6f60f77c2103028a43b177b to your computer and use it in GitHub Desktop.
Save ryansutc/3c829204e6f60f77c2103028a43b177b to your computer and use it in GitHub Desktop.
Docker Quick Reference

Docker Quick Reference

Docker CLI client

the docker cli client lets you manage your images & containers via a wrapper on api:

Get docker comfiguration:

docker system info

Create a docker image tagged w. a name w. docker build:

docker build -t <yourusername/yourappname> .

Run an image/start a container with docker run:

docker run -publish <yourport>:<containerport> --detach <your username>/<your app>

Get inside a container:

docker exec -it <container id> /bin/bash

Docker Machine

dockerengine runs in a vm environment. You can have several vm's (both locally and on remote servers). docker-machine lets you manage these.

Get configuration:

docker-machine inspect

List/Start/Stop/status your vm's:

docker-machine ls/start/stop/status

Swarms

Swarms allow you to deploy an application with clusters of containers to scale, each defined as "services". Swarms are defined in "stack files":

Deploy from stack file:

docker stack deploy -c <yourstackfile>.yaml <yourswarmappname> //creates service & network w. name

List/Remove services/networks/stacks:

docker service/network/stack ls/rm

Remove your stack:

docker stack rm <yourswarmappname>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment