Below are commonly used Docker commands and flags. For a complete list of Docker commands, see Docker's online command-line reference.
| Docker run command: | |
|---|---|
|
|
| Code Segment: | Function: |
docker run |
Run a command in a new container. |
-d |
The -d flag indicates to run the Docker
container in detached mode. This means that the Docker container
will run in the background of your terminal and will not receive
any input or display output. |
-p 80:8000 -p 443:44300 |
This code segment specifies the allocation of the ports being
used:
|
-v <Path to
workspace>:/bluecat_gateway/ |
This variable maps a Docker workspace on your local machine.
If you are using RHEL-compiled Docker, you must add
:Z at the end of the path for any mapped
volume. Note: If using Docker volumes, the command would be:
-v
<Docker_volume_name>:/bluecat_gateway.
|
-v <Path to mapped log
directory>:/logs/ |
This variable maps a Docker logs volume (recommended) or a logs directory on your local machine. |
-e BAM_IP=<Your Address Manager IP or
URL>
|
The environment variable is used to specify the IP address or
URL of the BAM that you want to integrate
with Gateway. You must enter the BAM IP as an environment variable when
running the Gateway container for the first
time. Note: Any path information in the BAM URL or IP address
is ignored.
To specify
multiple Address Manager servers when starting
a Gateway container, list all desired
IP addresses or URLs when setting the value of the
Each entry can be an IP address or a fully-qualified domain name and must be unique within that list. The list can use a mixture of URLs, IPv4, and IPv6 addresses. For clarity, you can enclose the entire list within quotation marks. For more details, see Connecting to multiple Address Manager servers during installation via the command line. |
--dns <ip address>
(optional) |
Sets the IP address of the container's nameserver in the
/etc/resolv.conf file. A process in the container, when
resolving a hostname that is not included in /etc/hosts, will
connect to this IP address on port 53 and search for name
resolution services. Note: If you do not include this option in
the docker command, the IP address of the DNS server
defaults to 8.8.8.8.
|
--name bluecat_gateway |
Indicates the name of the container. By default, the name of the container is bluecat_gateway; however, this can be changed to reflect the needs of your environment. |
quay.io/bluecat/gateway:<version> |
Refers to the Gateway image tag from which the container will be created. If the image has already been pulled and is available locally, the container will be created from that image. If the image is not available locally, it will be pulled from the Quay.io cloud registry. |
| Command | Description |
|---|---|
| docker login <repository domain> | Specify login credentials for a specific repository. |
| docker pull <image_name> | Download a particular image (from specified repository sources). |
| docker images | List all images present locally. |
| docker rmi <image_name|image_id> | Remove the image. |
| docker ps | List all running containers. |
| docker ps -a | List all containers |
| docker run [options] <image_name|image_id> | Run the docker image with specified options. |
| docker stop <container_name|container_id> | Stop a running container. |
| docker rm <container_name|container_id> | Remove a stopped container. |
| docker logs <container_name|container_id> | Look at logs for a running or stopped container. |
| docker kill <container_name|container_id> | Kill one or more running containers. |
| docker cp <container:path_to_file> <dest_path> | Copy the file from inside the container to your local host machine. |
| docker restart <container> | Restart the container. |
| docker rename <container> <new name> | Rename the container. |
| docker exec -it <container_name> bash | Runs an interactive bash shell on a running container. |
| Command | Description |
|---|---|
| docker run -t | Allocate a pseudo-tty. |
| docker run -d | Run container in detached mode. |
| docker run -p | Specify port mapping. |
| docker run -v | Map a volume. |