Skip to content

Commit

Permalink
move
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Jun 2, 2020
1 parent b37be05 commit 241c831
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 126 deletions.
95 changes: 95 additions & 0 deletions docker/appendix.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,99 @@ At one point I might create similar pages for some other countries as well.

Legacy system

## Docker Resources
{id: docker-resource}


* [Docker Documentation](https://docs.docker.com/)
* [Docker on Code-Maven](https://code-maven.com/docker)
* [Docker Tutorial for Beginners](https://www.youtube.com/watch?v=VlSW-tztsvM)
* [Docker Tutorial For Beginners](https://www.youtube.com/watch?v=sRIxHHZFwBA)
* [Docker Curriculum](https://docker-curriculum.com/)

## Docker Whalesay
{id: docker-hub-whalesay}

Go to [Docker Hub](https://hub.docker.com/) search for *whalesay* and note among the many hits there is one called
[docker/whalesay](https://hub.docker.com/r/docker/whalesay/). We'll use that one.

```
$ docker run docker/whalesay cowsay hello world
Unable to find image 'docker/whalesay:latest' locally
latest: Pulling from docker/whalesay
e190868d63f8: Pull complete
909cd34c6fd7: Pull complete
0b9bfabab7c1: Pull complete
a3ed95caeb02: Pull complete
00bf65475aba: Pull complete
c57b6bcc83e3: Pull complete
8978f6879e2f: Pull complete
8eed3712d2cf: Pull complete
Digest: sha256:178598e51a26abbc958b8a2e48825c90bc22e641de3d31e18aaf55f3258ba93b
Status: Downloaded newer image for docker/whalesay:latest
_____________
< hello world >
-------------
\
\
\
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/
```

## Docker ps after whalesay
{id: docker-ps-whalesay}

```
$ docker ps -as
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59c99df0177a docker/whalesay "cowsay hello world" 36 minutes ago Exited (0) 23 minutes ago loving_wescoff 0 B (virtual 247 MB)
f6239f10a6ad hello-world "/hello" About an hour ago Exited (0) 58 minutes ago lucid_snyder 0 B (virtual 1.84 kB)
```

```
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 48b5124b2768 6 weeks ago 1.84 kB
docker/whalesay latest 6b362a9f73eb 21 months ago 247 MB
```

## Docker whale (create Docker image)
{id: docker-whale}

Create *Dockerfile* with the following content:

![](examples/first/Dockerfile)

```
$ docker build -t docker-whale .
...
```

```
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker-whale latest d5cf6bf32c0f 24 seconds ago 277 MB
hello-world latest 48b5124b2768 6 weeks ago 1.84 kB
docker/whalesay latest 6b362a9f73eb 21 months ago 247 MB
```

The command `docker ps -a` shows nothing new.

## Run Docker whale
{id: run-docker-whale}

```
$ docker run docker-whale
```


126 changes: 0 additions & 126 deletions docker/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,117 +80,6 @@ docker exec -it 0ca23b8a9802 bash
docker kill ID if it does not want to stop
```

## Docker Resources
{id: docker-resource}


* [Docker Documentation](https://docs.docker.com/)
* [Docker on Code-Maven](https://code-maven.com/docker)
* [Docker Tutorial for Beginners](https://www.youtube.com/watch?v=VlSW-tztsvM)
* [Docker Tutorial For Beginners](https://www.youtube.com/watch?v=sRIxHHZFwBA)
* [Docker Curriculum](https://docker-curriculum.com/)


## Docker create image by save
{id: docker-create-image-by-save}

```
docker run -it debian
apt-get update
apt-get install htop
exit
docker commit 3db0a970e422 USERNAME/debian:1.00
docker run --rm -it USERNAME/debian:1.00
```

Check the history!

## Docker Whalesay
{id: docker-hub-whalesay}

Go to [Docker Hub](https://hub.docker.com/) search for *whalesay* and note among the many hits there is one called
[docker/whalesay](https://hub.docker.com/r/docker/whalesay/). We'll use that one.

```
$ docker run docker/whalesay cowsay hello world
Unable to find image 'docker/whalesay:latest' locally
latest: Pulling from docker/whalesay
e190868d63f8: Pull complete
909cd34c6fd7: Pull complete
0b9bfabab7c1: Pull complete
a3ed95caeb02: Pull complete
00bf65475aba: Pull complete
c57b6bcc83e3: Pull complete
8978f6879e2f: Pull complete
8eed3712d2cf: Pull complete
Digest: sha256:178598e51a26abbc958b8a2e48825c90bc22e641de3d31e18aaf55f3258ba93b
Status: Downloaded newer image for docker/whalesay:latest
_____________
< hello world >
-------------
\
\
\
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/
```

## Docker ps after whalesay
{id: docker-ps-whalesay}

```
$ docker ps -as
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59c99df0177a docker/whalesay "cowsay hello world" 36 minutes ago Exited (0) 23 minutes ago loving_wescoff 0 B (virtual 247 MB)
f6239f10a6ad hello-world "/hello" About an hour ago Exited (0) 58 minutes ago lucid_snyder 0 B (virtual 1.84 kB)
```

```
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 48b5124b2768 6 weeks ago 1.84 kB
docker/whalesay latest 6b362a9f73eb 21 months ago 247 MB
```

## Docker whale (create Docker image)
{id: docker-whale}

Create *Dockerfile* with the following content:

![](examples/first/Dockerfile)

```
$ docker build -t docker-whale .
...
```

```
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker-whale latest d5cf6bf32c0f 24 seconds ago 277 MB
hello-world latest 48b5124b2768 6 weeks ago 1.84 kB
docker/whalesay latest 6b362a9f73eb 21 months ago 247 MB
```

The command `docker ps -a` shows nothing new.

## Run Docker whale
{id: run-docker-whale}

```
$ docker run docker-whale
```

## Dockerfile
{id: docker-dockerfile}

Expand Down Expand Up @@ -302,21 +191,6 @@ docker logs CONTAINER_ID

* [logs](https://docs.docker.com/engine/reference/commandline/logs/)

## Docker networking
{id: docker-networking}

```
docker network list
NETWORK ID NAME DRIVER SCOPE
234aa213ed9a bridge bridge local
63a0fd629d21 host host local
37a165457dad none null local
```

```
docker network create abc creates a bridge called abc
```

## Ignore files and directories
{id: ignore-files-and-directories}
{i: .dockerignore}
Expand Down
16 changes: 16 additions & 0 deletions docker/create-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ There are two ways to create a Docker image on your computer:
* Run a container, install stuff, stop it, commit it.
* Create Dockerfile, run docker build.

## Docker create image by save
{id: docker-create-image-by-save}

```
docker run -it debian
apt-get update
apt-get install htop
exit
docker commit 3db0a970e422 USERNAME/debian:1.00
docker run --rm -it USERNAME/debian:1.00
```

Check the history!


## Create image from container
{id: create-image-from-container}
{i: commit}
Expand Down
1 change: 1 addition & 0 deletions docker/docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"python.md",
"perl.md",
"compose.md",
"networking.md",
"appendix.md"
]
}
20 changes: 20 additions & 0 deletions docker/networking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Docker networking
{id: docker-networking}


## Docker network list
{id: docker-network-list}

```
docker network list
NETWORK ID NAME DRIVER SCOPE
234aa213ed9a bridge bridge local
63a0fd629d21 host host local
37a165457dad none null local
```

```
docker network create abc creates a bridge called abc
```


0 comments on commit 241c831

Please sign in to comment.