Difference between revisions of "Docker/Current/Troubleshooting/Running Containers"

From Genesys Documentation
Jump to: navigation, search
(Published)
 
Line 6: Line 6:
 
|Section={{Section
 
|Section={{Section
 
|sectionHeading=Running Containers
 
|sectionHeading=Running Containers
|Type=Unstructured
+
|Standalone=No
|freetext=Containers are running instances of an Image. To run containers, follow these steps:
+
|ComingSoon=No
 +
|Status=No
 +
|alignment=Vertical
 +
|structuredtext=Containers are running instances of an Image. To run containers, follow these steps:
 
# Create a container from the base image for the latest version of the Ubuntu that is available.
 
# Create a container from the base image for the latest version of the Ubuntu that is available.
 
#: {{NoteFormat|
 
#: {{NoteFormat|
Line 19: Line 22:
 
}}{{Section
 
}}{{Section
 
|sectionHeading=Lifecycle
 
|sectionHeading=Lifecycle
|Type=Unstructured
+
|Standalone=No
|freetext=The following commands illustrate the Docker Lifecycle:
+
|ComingSoon=No
 +
|Status=No
 +
|alignment=Vertical
 +
|structuredtext=The following commands illustrate the Docker Lifecycle:
 
* <code>docker create</code> creates a container but does not start the container.
 
* <code>docker create</code> creates a container but does not start the container.
 
* <code>docker rename</code> allows the container to be renamed.
 
* <code>docker rename</code> allows the container to be renamed.
Line 40: Line 46:
 
}}{{Section
 
}}{{Section
 
|sectionHeading=Starting and Stopping a Container
 
|sectionHeading=Starting and Stopping a Container
|Type=Unstructured
+
|Standalone=No
|freetext=Commands to start and stop a container:
+
|ComingSoon=No
 +
|Status=No
 +
|alignment=Vertical
 +
|structuredtext=Commands to start and stop a container:
 
* <code>docker start</code> starts a container so it is running.
 
* <code>docker start</code> starts a container so it is running.
 
* <code>docker stop</code> stops a running container.
 
* <code>docker stop</code> stops a running container.

Revision as of 13:36, January 17, 2020

This topic is part of the manual Running Containers and Troubleshooting for version Current of Genesys Docker Documentation.

Instructions to run the Docker containers.

Running Containers

Containers are running instances of an Image. To run containers, follow these steps:

  1. Create a container from the base image for the latest version of the Ubuntu that is available.
    Important
    • If you do not have an Ubuntu base image installed locally, extract the latest one for your local repository.
    • You must start the container in interactive mode attached to the current terminal and running the bash shell.
    • After running, make sure you shut down the container by running 'exit'.
Code-1.JPG
  • Run the appropriate Docker command to obtain the name of the previously run container. Issue the appropriate command to restart the container for which you obtained the name. Do NOT create a new container. Restart the container that was just used.
    Code2.JPG
  • Stop the container, and then remove the container from the system by using the following command.
    Code3.JPG
  • Create (not run) a container called "my_container" by using the parameters that will allow the container to run interactively, and get the terminal attached to the local console running the bash shell. Ensure the container is not running.
    Code4.JPG
  • Start the container, and ensure the container is running. Run the following command to attach your session to the running container to ensure you are logged on to the shell.
    Code5.JPG
  • Lifecycle

    The following commands illustrate the Docker Lifecycle:

    • docker create creates a container but does not start the container.
    • docker rename allows the container to be renamed.
    • docker run creates and starts a container in a single operation.
    • docker rm deletes a container.
    • docker update updates a container's resource limits.

    Usually, when you run a container without options, it will start and stop immediately. If you want the container to keep running, you can use the command, docker run -td container_ID. This command uses the option-t to allocate a pseudo-TTY session and option-d to detach the container automatically (you can run container in background and print the container ID).

    To have a transient container, use the command docker run –rm. This command will remove the container after it stops.

    To map a directory on the host to a docker container, use the command docker run -v $HOSTDIR:$DOCKERDIR<.

    To remove the volumes associated with the container, the deletion of the container must include the option-vswitch like in docker rm -v.

    There is also a logging driver available for individual containers in docker 1.10. To run docker with a custom log driver (that is syslog), use the command docker run --log-driver=syslog.

    docker run --name yourname docker_image is a useful command because when you specify --name inside the run command, you can start and stop a container by calling it with the name that you specified when you created it.

    Starting and Stopping a Container

    Commands to start and stop a container:

    • docker start starts a container so it is running.
    • docker stop stops a running container.
    • docker restart stops and starts a container.
    • docker pause pauses a running container, "freezing" it in place.
    • docker unpause unpauses a running container.
    • docker wait blocks until running container stops.
    • docker kill sends a SIGKILL signal to a running container.
    • docker attach connects to a running container.

    To integrate a container with a host process manager, start the daemon with the commands -r=false and then use docker start -a.

    Comments or questions about this documentation? Contact us for support!