Apparently, Docker is working on a MacOS specific version. (Looks like it's a little more integrated into the OS, with a status menu/icon in the top menu bar. )
- Started with this page: https://docs.docker.com/docker-for-mac
- Did an experimental install of conda: https://docs.continuum.io/anaconda/docker
- And found a good docker conceptual overview here: https://michael.bouvy.net/blog/en/2014/02/01/what-is-docker-and-how-to-use-it-lxc-openvz
- Created a CentOS image that runs an ssh server modeled off of this github: https://github.com/tutumcloud/tutum-centos
What I Learned
- There are many pre-made docker-images available for download.
- Basic ones like debian or centos.
- Specific applications like apache, or jenkins.
- Docker has commands for managing these images.
- docker search - Searches docker hub for published images.
- docker images - Displays the images present locally.
- docker pull - Pulls an image from a registry (default docker-hub) to local machine.
- docker rmi - Deletes a local image.
- Docker images are "instantiated" into Docker-containers.
- Containers may be interactive or not.
- They may run in the background "detached" or foreground.
- The commands:
- docker run - Starts up an image as a container.
- docker ps - Lists active containers. (use -a for inactive as well)
- docker start - Reactivates a stopped container.
- docker attach - Attaches to a running a backgrounded container
- docker rm - Deletes a container.
- Containers will normally run to completion and exit, becoming deactive.
- Interactive containers will typically run /bin/bash or another interactive environment.
- When the user exits, the container becomes inactive.
- Non-interactive containers can be used to run services like sshd, or httpd.
- Internal to the container, the service is often run in non-backgrounded mode. This prevents the process from completing and the container from deactivating.
- The start command is good for re-attaching to a container that was just a shell. Using the run command will create a new container.
- Don't try to attach to a running container if it's running something other than a shell. The CTRL-C interrupts don't work unless certain flags are passed to the attach command.
- New docker images can be made using a Dockerfile.
- It's a series of instructions that when complete, leaves an image in the state of the last instruction.
- Intermediate images are constructed, so it doesn't re-run the entire docker-file each time.
- The Dockerfile can
- ADD local files _into_ the docker image.
- RUN commands that change the state of the image.
- CMD is the final command that is the main entry point when the image is run.
- The command:
- docker build - Builds the local Dockerfile
- Names!
- If an image isn't given a tag, it is only identified by an awkward hashcode.
- If a container isn't given a name, it is provided a fun random name, like "evil_davinci", or "sad_minsky".