Commands used in Try Docker

Go through the course Try Docker, and here’re the commands used in the three steps:

Level 1.
docker container run httpd:2.4

docker container run -p 80:80 httpd:2.4

docker container run -p 9999:80 httpd:2.4

docker container ls
docker container exec elegant_noether du -mh

docker container exec -it elegant_noether /bin/bash
du -mh.

docker container exec -it elegant_noether /bin/bash
apt-get install -y fortunes
/usr/games/fortune

docker container exec -it elegant_noether /bin/bash
PATH=$PATH:/usr/games/
export PATH
fortune

Level 2:
Dockerfile
FROM httpd:2.4
EXPOSE 80
RUN apt-get update && apt-get install -y fortunes
LABEL maintainer="moby-dock@example.com"

$ docker image build --tag web-server:1.0 .

$ docker image ls

$ docker container run -p 80:80 web-server:1.0

Level 3:
$ curl localhost:80/page.html
$ docker container cp page.html elegant_noether:/usr/local/apache2/htdocs/

Add COPY page.html /usr/local/apache2/htdocs/ to Dockerfile

$ docker container run -p 80:80 --detach web-server:1.1
curl localhost:80/page.html

$ docker run -d -p 80:80 --name my-web -v /my-files:/usr/local/apache2/htdocs we
b-server:1.1
docker container exec -it my-web /bin/bash
root@ba07c56ea949:/usr/local/apache2# cd /usr/loca/apache2/htdocs
ls -la

More resources suggested by author:

https://www.docker.com/
https://hub.docker.com/explore/
https://www.pluralsight.com/paths/docker
https://github.com/portainer/portainer

install Docker in Mac

Docker is an open-source project that automates the deployment of applications inside software containers. Docker CE(Community Edition) for Mac is an easy-to-install desktop app for building, debugging, and testing Dockerized apps on a Mac.

1. system requirement

Docker for Mac works on OS X El Capitan 10.11 and newer macOS releases.

2. download Docker installation package

The stable Docker image for Mac can be downloaded with link.

3. install

Double-click Docker.dmg in your download folder, and follow the installation process.

After the installation is completed, goto Launchpad and start Docker by clicking the icon. After that, the whale in the top status bar shows that Docker is running, and accessible from a terminal.

4. test and run

Open a terminal, and try out some Docker commands to make sure it’s properly installed.

  • Run docker version to check that you have the latest release installed.

  • Run docker run hello-world to verify that Docker is pulling images and running as expected.