Microsoft SQL Server clients

To connect to an MSSQL database

on Macintosh

on Windows

Connect the Portainer Server to an existing Portainer Agent

With Portainer we can monitor multiple Docker Swarms from one Portainer Server. To connect an existing Portainer server to an agent

Configure the Agent

  • For security reasons, by default, the Portainer Agent only accepts connection from the first Portainer Server it encounters. To enable the Portainer Agent to connect to multiple Portainer Servers, add the AGENT_SECRET environment variable to the docker-compose.yml file of the Agent. This is necessary if you launch a Portainer Server on the Docker host and connect to the local Agent to test it. Without specifying the AGENT_SECRET, another Portainer Server cannot connect to the same agent.
  • Publish the Agent port on the host network
      # REQUIRED: Should be equal to the service name prefixed by "tasks." when
      # deployed inside an overlay network
      AGENT_CLUSTER_ADDR: tasks.agent
      # AGENT_PORT: 9001
      # LOG_LEVEL: debug
      AGENT_SECRET: my_secret_token
      - target: 9001
        published: 9001
        protocol: tcp
        mode: host

Configure the Server

  • Add the AGENT_SECRET environment variable to the docker-compose.yml file of the Server
      AGENT_SECRET: my_secret_token

Add the endpoint to the Portainer Server

  • Log into the Portainer Server
  • Navigate to the Endpoints page
  • Click the Add Endpoint button
  • Select the Agent endpoint type
  • Enter the IP address and the port number ( by default 9001 ) of the Portainer Agent

Portainer troubleshooting

The Portainer server restarts every 5 minutes before the admin account is created

When the Portainer server starts, waits 5 minutes for a user to create the admin account. If no account created in the first 5 minutes, the server stops with error code 1, message:

No administrator account was created after 5 min. Shutting down the Portainer instance for security reasons.

To keep the Portainer server running, with your web browser navigate to the web UI on port 9000 and enter a password for the admin account.

Troubleshoot stopped containers

The stopped Docker containers are still available for troubleshooting. You can create an image of them and run them as new containers to inspect the log files and execute commands in them.

View the standard output of the failed container

docker logs MY_CONTAINER_ID

Run a failing container with a Bash terminal

If a container exists with an error within a few seconds, it can be beneficial to start a terminal window in it to view the log files and execute commands. We will override the entry point of the container to start a Bash terminal.

Create an image of the stopped container


Run the saved image as a new container and start a Bash terminal instead of the original entry point

docker run -it --entrypoint bash MY_NEW_IMAGE_NAME

Docker Swarm Commands

Create a service with an image in a private registry

These instructions will pass the login token from your local client to the Docker Swarm nodes, so those are able to log into the registry and pull the image.

# Save the Docker Registry password in the PASSWORD environment variable 

# Log into the Docker Registry
echo $PASSWORD | docker login -u [user] --password-stdin

# Create the service
docker service create \
  --with-registry-auth \
  --name my_service \