Skip to content

Commit

Permalink
Merge pull request #50 from CiscoCloud/vibhi
Browse files Browse the repository at this point in the history
Vibhi
  • Loading branch information
vvaliapa committed Sep 18, 2020
2 parents 59cd85c + 8e400e5 commit 6331d9c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
18 changes: 11 additions & 7 deletions labs/docker-101/3.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@ Next we'll build our own Ubuntu Docker image instead of using the one from Docke
Docker prints progress messages as it builds the Ubuntu image. Once it finishes building the image, Docker assigns it a randomly-chosen name.

4. Run the command `docker images`.
Docker lists all the images on your system, including both the newly-built one and any that you previously downloaded. You can tell which image is the one you just created by examining the list; it's the only image that isn't associated with a repository:
Docker lists all the images on your system, including both the newly-built one and any that you previously downloaded. You can tell which image is the one you just created by examining the list; it's the only image that isn't associated with a repository:

![Docker Images](assets/images/images1.png)

5. Run the newly created Docker image by giving the randomly-chosen ID to Docker:
```
docker run -ti <your image ID>
```
The newly-created image behaves exactly the same way as the Ubuntu image from Dockerhub, because it is built from the same Dockerfile. You now have a bash root prompt.
The newly-created image behaves exactly the same way as the Ubuntu image from Docker Hub, because it is built from the same Dockerfile. You now have a bash root prompt.

6. Enter ``ls`` to confirm standard Ubuntu directories are installed.
6. Run the following command to confirm standard Ubuntu directories are installed:
```
ls
```

# Building a Custom Cisco Learning Labs Container

Expand Down Expand Up @@ -112,14 +116,14 @@ To update the image, follow the below instructions:
```
docker build .
```
Docker prints progress messages as it builds the Ubuntu image. Once it finishes building the image, Docker displays `Succesfully built <container ID> `.
Make note of the newly built container ID so that you can use it in the next step.
Docker prints progress messages as it builds the Ubuntu image. Once it finishes building the image, Docker displays `Succesfully built <CONTAINER ID> ` message.
Make note of the newly built `<CONTAINER ID>` so that you can use it in the next step.

3. Run the new container using the following command.
Use the container ID that you recieved from the `docker build .` command output.
Use the `<CONTAINER ID>` that you recieved from the `docker build .` command output.

```
docker run <Container ID>
docker run <CONTAINER ID>
```
The "Hello from DevNet!" message is displayed in the container terminal.

Expand Down
18 changes: 9 additions & 9 deletions labs/docker-101/4.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ To build a container that runs this web server we need to change the `CMD` line
Hello Cisco
```

* ENTRYPOINT [“python”, “-m”, “SimpleHTTPServer”, “8000”]
Like CMD, the ENTRYPOINT command runs a program, but it also does something else: it enables us to pass arguments to the program. We use this feature to pass arguments to Python to start the web server.
* ENTRYPOINT [“python”, “-m”, “SimpleHTTPServer”, “8000”]
Like CMD, the ENTRYPOINT command runs a program, but it also does something else: it enables us to pass arguments to the program. We use this feature to pass arguments to Python to start the web server.

2. Build and run the new web server container image using the following command:

```
docker build .
docker run -P <your new container id> &
docker run -P <your new CONTAINER ID> &
```

Why don't we see any output?
Expand All @@ -65,26 +65,26 @@ To build a container that runs this web server we need to change the `CMD` line
The web server is running. Now how do we connect to it?

By default Docker gives each container an internal IP address on the host.
Make note of the container ID of the new web server image so that you can use it in the next step.
Make note of the `<CONTAINER ID>` of the new web server image so that you can use it in the next step.

4. Run the following command to find out the container's IP address.
You can use the container ID of the new web server image that is received from the `docker ps` command output.
You can use the `<CONTAINER ID>` of the new web server image that is received from the `docker ps` command output.

```
docker inspect <container ID>
docker inspect <CONTAINER ID>
```
Running this command displays a great deal of information about the container. Included in the output is the container's address, identified as "IPAddress".

![Docker Inspect](assets/images/dockerinspect.png)

Now that we know the IP address and port on which the web server can be reached, we can make a connection.
Make note of the IP address of the container so that you can use it in the next step.
Make note of the `IPAddress` of the container, so that you can use it in the next step.

5. Run the following command to make the connection.
You can use the IP address of the container that is received from the `docker inspect <container ID>` command output.
You can use the IP address of the container that is received from the `docker inspect <CONTAINER ID>` command output.

```
curl http://<container IP>:8000
curl http://<CONTAINER IPAddress>:8000
```

The built-in Python web server by default serves the contents of its working directory. Because the Dockerfile copied the Python script to the root of the container, that's the directory that the web server displays:
Expand Down

0 comments on commit 6331d9c

Please sign in to comment.