Vous êtes sur la page 1sur 3

DevOps www.edureka.

co/devops

Module 5: Docker Commands & Use


Cases
Assignment

© Brain4ce Education Solutions Pvt. Ltd.

Version 1.0
Module 5: Docker Commands & Use Cases www.edureka.co/devops

Module 5: Assignment
1.Create a Custom image from docker file.
 Create a directory called 'custom' and change to it. In this directory, create an empty file
called "Dockerfile".
Edit the "Dockerfile" created in above. This configuration file should be written to
perform the following actions:
 Use the base Centos 6 Latest version image from the public repository
 Identify you and your email address as the author and maintainer of this image
 Update the base OS after initial import of the image
 Install the Open-SSH Server
 Install Apache Web Server
 Expose ports 22 and 80 to support the services installed
 Build the custom image from the 'Dockerfile' as created above. Name/tag this new image
as "mycustomimg/withservices:v1". Once the image is built, verify the image appears in
your list
Take a screenshot of the terminal showing successful execution of each operation mentioned
above.
2.Create containers and manage them
 Create a container from the base image for the latest version of Ubuntu available. The
container should be started in interactive mode attached to the current terminal and
running the bash shell. Once running, exit the container.
 Run the Docker command to get the name of the previously run container. Issue the
appropriate command to restart the container that you obtained the name of. Do NOT
create a new container, restart the one we just used.
 Stop the container. Remove that container from the system completely using the
appropriate command.
 Create a container called "my_container", create it with parameters that will allow it to
run interactively and attached to the local console running the bash shell. Verify that the
container is not running.
 Start the container and again, verify the container is running. Run the appropriate
command to attach your session to the running container so you are logged into the
shell.
Take a screenshot of the terminal showing successful execution of each task mentioned
above.
3. Add external contents to containers.
 Create a directory in your 'user' home directory called 'docker'. Within that directory,
create another directory called 'mydata'. Within that directory, create a file called
'mydata.txt' containing any text message you want.
Take a screenshot of the terminal showing successful directories creation

©Brain4ce Education Solutions Pvt. Ltd Page 1


Module 5: Docker Commands & Use Cases www.edureka.co/devops

 Create a docker container name 'local_vol' from the 'centos:6' image. The container
should be created in interactive mode, attached to the current terminal and running the
bash shell. Finally create the container with a volume (or directory) called 'containerdata'
so that the system will automatically create the directory/mount when the container
starts.
Take a screenshot of the terminal showing successful execution of the mentioned task.
 List the filesystems within the container, specifically looking for the volume/directory
that was added to the container during creation.
 Exit the container. This time, create another container called 'remote_vol' with the same
container configuration except when creating the volume in the container, link the volume name
'mydata' to the underlying host directory structure created .
Take a screenshot of the terminal showing successful execution of the mentioned task.

©Brain4ce Education Solutions Pvt. Ltd Page 2

Vous aimerez peut-être aussi