Skip to content

Instantly share code, notes, and snippets.

@firemanxbr
Last active January 27, 2024 12:03
Show Gist options
  • Save firemanxbr/292269fdb4c565118a2dd09c7bed4036 to your computer and use it in GitHub Desktop.
Save firemanxbr/292269fdb4c565118a2dd09c7bed4036 to your computer and use it in GitHub Desktop.
Annotations - DO180: Introduction to Containers, Kubernetes, and Red Hat OpenShift

[CHAPTER 1 - Quiz 1]

Solutions:

1. a, b

2. a, c

3. a, b

4. b, c, e

[CHAPTER 1 - Quiz 2]

Solutions:

1. a, c, d

2. b

3. a, c

4. b

[CHAPTER 1 - Quiz 3]

Solutions:

1. b, c, d

2. c, d

3. a, e

4. b

5. a

[CHAPTER 2 - Docker - Install]

Do you need the service of docker running to use the next tools. In that case check if you have this package and service:

$ rpm -q docker

$ systemctl status docker

[CHAPTER 2 - Minishift]

Installation will require the VirtualBox: https://www.virtualbox.org/wiki/Downloads, more this packages to KVM:

$ sudo dnf install libvirt qemu-kvm

Configuration:

$ sudo usermod -a -G libvirt <username>

$ newgrp libvirt

Download:

https://github.com/minishift/minishift/releases

After unpack into directory of minishift cli you can use:

$ ./minishift start (start a minishift cluster locally)

$ ./minishift stop (stop the cluster)

$ ./minishift delete (delete the cluster)

$ ./minishift status (check the status of cluster)

[CHAPTER 2 - OC]

For install 'oc' tool do you need just run:

$ oc (if not installed it will request)

After installed you can use(like the Minishift):

$ sudo oc cluster up

$ sudo oc cluster down

$ sudo oc cluster status

[CHAPTER 2 & 3 - Docker]

# docker search mysql (search on Docker Hub an image)

# docker pull mysql (download an image)

# docker images (list of local images)

# docker run --name my-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest (create a container using this image)

# docker stop my-mysql (stop the container)

# docker run -e MYSQL_ROOT_PASSWORD=my-secret-pw -it --rm mysql:latest (execute a container with interative mode)

# docker ps (check the process of your containers)

# docker rmi -f mysql:latest (delete local image)

# docker inspect fedora (list listing metadata about JSON)

# docker inspect -f '{{ .Created }}' fedora (date of created the container)

# docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -v /var/dbfiles:/var/lib/mysql -d mysql:latest (run the container with the Reclaiming Storage)

# docker inspect -f '{{ .NetworkSettings.IPAddress }}' some-mysql (get the IPAddress in use of this container)

# docker rmi $(docker images -q) (remove all images)

[CHAPTER 4 - Quiz 1]

Solution:

1. a, d

2. d

3. a, d

4. c

[CHAPTER 4 - Manipulating Container Images]

# docker save -o mysql.tar registry.access.redhat.com/rhscl/mysql-56-rhel7 (save .tar file of the image mentioned)

# docker load -i mysql.tar (load the image from .tar file)

Creating a new image based in pre existent image:

# docker pull nginx (pull a image)

# docker run --name nginx-custom -d nginx:latest (create a new container based in this image)

# docker stop nginx-custom (stop the container)

# docker diff nginx-custom (check the diff)

# docker commit nginx-custom nginx-newversion (save a new image based in container created)

# docker tag nginx-newversion devops/nginx-newversion:0.0.1 (tag the new image)

# docker push docker.io/firemanxbr/nginx-myversion:0.0.1

[CHAPTER 5 - Create a custom container images]

# dnf install -y source-to-image source-to-image-unit-test (install s2i tool)

[CHAPTER 5 - Quiz 1]

Solutions:

1. b

2. b, c

3. a, b, c 

# docker build -t NAME:TAG DIR (docker build creating a new image)

[CHAPTER 6 - Deploying]

Solutions:

1. c, e

2. b, d

3. c

[CHAPTER 7 - Quiz 1]

Solutions:

1. c

2. a, c, d 

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