Docker command summary

If you are new to Docker, this section provides an introduction to common commands and options that are useful to know when administering a Conjur container installation. See the full list of commands in the Docker CLI documentation.

 

Podman is CLI-compatible with the Docker CLI. You can configure alias docker=podman for the shell that sets up the Conjur Server. This way, all the docker commands can be used when working with Podman.

Alternatively, you can manually replace docker in each command with podman.

All references to Docker in this document apply to Podman as well.

Commands

Command Description
docker run Start a container from an image.
docker exec Run a command inside a container.
docker restart Restart a running container.
docker stop Stop a container.
docker rm Remove a container.
docker ps List running containers.
docker cp Copy files to/from a container.
docker logs <container_name>

View the logs (stdout) of a container.

To follow logs, add the -f option before the container name:

docker logs -f <container_name>

Below are some useful commands for interacting with the Conjur container within a host VM:

Action

Command

Get a shell in the container

docker exec -it conjur-appliance bash

Run a one-off command in a container.

If the command requires input from the host, be sure to use the -i/--interactive (keeps STDIN open) and/or -t/--tty (allocates a pseudo TTY) options as needed.

docker exec docker-appliance <command>

Copy a file from the host to the container.

Usually it's recommeded to volume-mount a host directory into the container.

docker cp /local-dir/file-name conjur-appliance:/container-dir/file-name

Copy a file from container to the host.

docker cp conjur-appliance:/container-dir/file-name /local-dir/file-name 

Options

Many options can be passed to docker run that affect how a container behaves. The following are commonly-used options for running a Conjur container. All options are covered in full in the docker run reference.

Command Description
--name Set a name for the container.
-d / --detach Run the container in the background.
--restart Set the container's restart policy.
--security-opt Run the container with a security profile.
-p / --port Forward a port from the container to the host.
-v / --volume Mount a directory/file from the host into the container.
-e / --env Set a list of environment variables within the container when it is run.