Common Docker Operations

  • Last update: 2024-07-22
  • Overview

    If the O&M platform is deployed in a containerized environment, you need to have some basic docker O&M knowledge.

    Viewing Container ID/Container Name/Container Status

    iconNote:

    You are advised to prioritize using FineOps's O&M Component and Component Management functions to view container information.

    Command: docker ps-a

    Returned value description: You can view the status, port mappings, and other important information of all containers to better manage and debug containerized applications.

    Returned Value

    Description

    CONTAINER ID

    It shows the unique identifier of the container.

    It is usually represented as a combination of capital letters and numbers.

    IMAGE

    It shows the name of the image used by the container.

    COMMAND

    It shows the command used to start the container.

    CREATED

    It shows the timestamp of container creation.

    STATUS

    It shows the running status and health conditions of the container, such as running (Up), stopped (Exited), and restarting.

    PORTS

    It shows the ports exposed by containers and the ports bound to hosts.

    NAMES

    It shows specified names or automatically generated names of containers.

    Example:

    In the sample server, you can see an ops container with the ID f1ac156d4db9, using ops: v1.6.0 image, and running with the container name fanruan230718121827_ops.

    The container was created 6 days ago and has been running for six days since its creation. The container is marked as healthy, indicating that the internal application is running normally and is in good condition.

    It maps port number 8081 of the host 192.168.101.58 to port number 8080 of the container, meaning you can communicate with ops by accessing the host's 192.168.101.58:8081 IP address.

    Restarting/Stopping/Starting the Container

    Command:

    Scenario

    Command

    Restarting the container

    docker restart Container ID/Container name

    Stopping the container

    docker stop Container ID/Container name

    Starting the container

    docker start Container ID/Container name

    This section shows how to stop and start ops containers.

    Stopping Ops Containers

    1.Search for containers with ops in names: docker ps -a | grep ops.

    You can identify the container ID: f1ac156d4db9 based on the returned value.

    2.Stop the container: docker stop f1ac156d4db9.

    3.Search for containers with ops in names again: docker ps -a | grep ops.

    Confirm that the container status is Exited, indicating that the container has been successfully stopped.

    Starting Ops Containers

    1. Search for containers with ops in names: docker ps -a | grep ops.

    Confirm that the container status is Exited now, indicating that the container has not been started. You can identify the container ID: f1ac156d4db9 based on the returned value.

    2. Start the container: docker start f1ac156d4db9.

    3. View all container status: docker ps -a.

    Make sure that the ops container and its associated components (such as ops_agent) are all started.

    Viewing Ops Logs Online in Real-time

    1. Search for containers with ops in names: docker ps -a | grep ops.

    You can identify the ops container ID: 7b396943b0da based on the returned value.

    2. Monitor container logs in real-time: docker logs -f 7b396943b0da.

    Downloading Ops Logs

    1. Search for containers with ops in names: docker ps -a | grep ops.

    You can identify the ops container ID: 7b396943b0da based on the returned value.

    2. View the configuration of the ops container: docker inspect 7b396943b0da.

    3. You can view logs' storage location under Binds of the returned value and download them.

    Attachment List


    Theme:
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read