Unauthorized docker agent is not shown in docker server

Hello,

I started teamcity-server and teamcity-agent from docker and, as far as I understand, the agent is expected to be shown in the Agents | Unauthorized tab.

Unfortunately, the tab's title is Unauthorized (1) but nothing is shown there (check the screenshot below).

The containers were started using the following commands:

docker run -d -v /opt/teamcity/server/data:/data/teamcity_server/datadir -v /opt/teamcity/server/logs:/opt/teamcity/logs -p 8111:8111 --restart always --name teamcity-server jetbrains/teamcity-server
docker run -d -v /opt/teamcity/agent:/data/teamcity_agent/conf -v /var/run/docker.sock:/var/run/docker.sock -v teamcity-agent-volume:/opt/buildagent/work -e SERVER_URL="http://139.59.45.139:8111" --restart always --name teamcity-agent jetbrains/teamcity-agent

Agent log:

[2018-09-28 15:31:20,454] INFO - s.buildServer.agent.AgentMain2 - ===========================================================
[2018-09-28 15:31:20,489] INFO - s.buildServer.agent.AgentMain2 - TeamCity Build Agent 2018.1.2 (build 58537)
[2018-09-28 15:31:20,508] INFO - s.buildServer.agent.AgentMain2 - OS: Linux, version 4.4.0-134-generic, amd64, Current user: root, Time zone: UTC
[2018-09-28 15:31:20,511] INFO - s.buildServer.agent.AgentMain2 - Java: 1.8.0_161, Java HotSpot(TM) 64-Bit Server VM (25.161-b12, mixed mode), Java(TM) SE Runtime Environment (1.8.0_161-b12), Oracle Corporation; JVM parameters: -ea -Xmx384m -Dteamcity_logs=../logs/
[2018-09-28 15:31:20,511] INFO - s.buildServer.agent.AgentMain2 - Starting...
[2018-09-28 15:31:20,628] INFO - buildServer.agent.AgentMain2$2 - Refreshing jetbrains.buildServer.agent.AgentMain2$2@6321e813: startup date [Fri Sep 28 15:31:20 UTC 2018]; root of context hierarchy
[2018-09-28 15:31:24,632] INFO - jetbrains.buildServer.AGENT - Calculating CPU benchmark index...
[2018-09-28 15:31:31,154] INFO - jetbrains.buildServer.AGENT - CPU benchmark index is set to 528
[2018-09-28 15:31:31,409] INFO - jetbrains.buildServer.AGENT - Agent tools download temp directory created on path /opt/buildagent/temp/tools
[2018-09-28 15:31:31,904] INFO - dAgentConfigurationInitializer - Loading build agent configuration from /data/teamcity_agent/conf/buildAgent.properties
[2018-09-28 15:31:31,977] INFO - s.buildServer.agent.AgentMain2 - Working dir: /opt/buildagent/work
[2018-09-28 15:31:31,977] INFO - s.buildServer.agent.AgentMain2 - Temp dir: /opt/buildagent/temp
[2018-09-28 15:31:31,979] INFO - rver.plugins.PluginManagerImpl - ===========================================================
[2018-09-28 15:31:31,979] INFO - rver.plugins.PluginManagerImpl - Plugins initialization started...
[2018-09-28 15:31:31,981] INFO - rver.plugins.PluginManagerImpl - Scanning plugins folders
[2018-09-28 15:31:31,985] INFO - .plugins.files.JarSearcherBase - Scanning plugin folder: /opt/buildagent/plugins
[2018-09-28 15:31:31,987] INFO - .plugins.files.JarSearcherBase - Scanning plugin folder: /opt/buildagent/tools
[2018-09-28 15:31:32,016] INFO - rver.plugins.PluginManagerImpl - Found 1 non bundled plugins: [amazonEC2]
[2018-09-28 15:31:32,016] INFO - rver.plugins.PluginManagerImpl - Found 0 bundled plugins: []
[2018-09-28 15:31:32,024] INFO - rver.plugins.PluginsCollection - Load shared classloader for 1 plugins [amazonEC2]
[2018-09-28 15:31:32,049] INFO - rver.plugins.PluginsCollection - No plugins were loaded with standalone classloaders
[2018-09-28 15:31:32,380] INFO - rver.plugins.PluginManagerImpl - Plugins initialization completed (1 plugins loaded): [amazonEC2]
[2018-09-28 15:31:32,381] INFO - rver.plugins.PluginManagerImpl - ===========================================================
[2018-09-28 15:31:32,384] INFO - jetbrains.buildServer.AGENT - Build Agent version: 58537, plugins signature: NA
[2018-09-28 15:31:32,415] INFO - dAgentConfigurationInitializer - Loading build agent configuration from /data/teamcity_agent/conf/buildAgent.properties
[2018-09-28 15:31:32,605] INFO - n.AmazonInstanceMetadataReader - Amazon is not available. Failed to connect to http://169.254.169.254/2016-04-19 Server status: 404 (Not Found)
[2018-09-28 15:31:32,655] INFO - .agent.impl.OsArchBitsDetector - Detecting via "getconf LONG_BIT", exit code: 0, output: 64
[2018-09-28 15:31:32,655] INFO - .agent.impl.OsArchBitsDetector - "teamcity.agent.os.arch.bits" detected as "64"
[2018-09-28 15:31:32,666] INFO - jetbrains.buildServer.AGENT - Start build agent
[2018-09-28 15:31:32,692] INFO - jetbrains.buildServer.AGENT - Agent Web server started on port 9090
[2018-09-28 15:31:32,709] INFO - agent.impl.AgentPortFileWriter - Writing agent runtime file to /opt/buildagent/logs/buildAgent.xmlRpcPort
[2018-09-28 15:31:32,715] INFO - agent.impl.AgentPortFileWriter - Launcher version is 58537
...skipping...
[2018-09-28 15:32:06,877] INFO - jetbrains.buildServer.AGENT - Agent Web server started on port 9090
[2018-09-28 15:32:06,906] INFO - agent.impl.AgentPortFileWriter - Writing agent runtime file to /opt/buildagent/logs/buildAgent.xmlRpcPort
[2018-09-28 15:32:06,912] INFO - agent.impl.AgentPortFileWriter - Launcher version is 58537
[2018-09-28 15:32:06,913] INFO - agent.impl.AgentPortFileWriter - Writing agent runtime file to /opt/buildagent/logs/buildAgent.xmlRpcPort :DONE!
[2018-09-28 15:32:06,940] INFO - buildServer.AGENT.registration - Registering on server via URL "http://139.59.45.139:8111": AgentDetails{Name='ip_172.17.0.3', AgentId=null, BuildId=null, AgentOwnAddress='null', AlternativeAddresses=[172.17.0.3], Port=9090, Version='58537', PluginsVersion='58537-md5-8727fbe0ae56b7cf9751d53d44f0d141', AvailableRunners=[DockerCommand, DockerCompose, gradle-runner, simpleRunner], AvailableVcs=[jetbrains.git], AuthorizationToken='c359129ac22152811a9c1b725207a4c8', PingCode='UULgCTt7U9gsEZQZRnDpeZuoW8Dx1fyH'}
[2018-09-28 15:32:07,021] INFO - jetbrains.buildServer.AGENT - Build agent started
[2018-09-28 15:32:07,331] INFO - buildServer.AGENT.registration - Server supports the following communication protocols: [polling]
[2018-09-28 15:32:07,331] INFO - buildServer.AGENT.registration - Trying to register on server using 'polling' protocol.
[2018-09-28 15:32:07,399] INFO - r.artifacts.impl.HttpDiskCache - Cleaning up items with life time in cache greater than 172800 seconds
[2018-09-28 15:32:07,402] INFO - r.artifacts.impl.HttpDiskCache - Finished cleaning up expired items, 0 items removed
[2018-09-28 15:32:07,408] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/temp/.old
[2018-09-28 15:32:07,408] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/work/.old
[2018-09-28 15:32:07,713] INFO - ldServer.AGENT.PollingProtocol - Start polling server for commands
[2018-09-28 15:32:07,729] INFO - buildServer.AGENT.registration - Registered on server with id 1 and authorization token 'c359129ac22152811a9c1b725207a4c8'
[2018-09-28 15:32:07,730] INFO - buildServer.AGENT.registration - If this is the first time this agent registered on the server make sure it is authorized by administrator in the server web UI.
[2018-09-28 15:32:07,763] INFO - ldServer.AGENT.PollingProtocol - New command is received from server "testLocal" {id = 1}
[2018-09-28 15:32:07,768] INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)
[2018-09-28 15:32:09,721] INFO - jetbrains.buildServer.AGENT - Updating agent parameters on the server: AgentDetails{Name='ip_172.17.0.3', AgentId=1, BuildId=null, AgentOwnAddress='null', AlternativeAddresses=[172.17.0.3], Port=9090, Version='58537', PluginsVersion='58537-md5-8727fbe0ae56b7cf9751d53d44f0d141', AvailableRunners=[DockerCommand, DockerCompose, gradle-runner, simpleRunner], AvailableVcs=[jetbrains.git], AuthorizationToken='c359129ac22152811a9c1b725207a4c8', PingCode='UULgCTt7U9gsEZQZRnDpeZuoW8Dx1fyH'}
[2018-09-28 15:37:07,395] INFO - r.artifacts.impl.HttpDiskCache - Cleaning up items with life time in cache greater than 172800 seconds
[2018-09-28 15:37:07,396] INFO - r.artifacts.impl.HttpDiskCache - Finished cleaning up expired items, 0 items removed
[2018-09-28 15:37:07,396] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/temp/.old
[2018-09-28 15:37:07,396] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/work/.old
[2018-09-28 15:37:07,435] INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)
[2018-09-28 15:42:07,395] INFO - r.artifacts.impl.HttpDiskCache - Cleaning up items with life time in cache greater than 172800 seconds
[2018-09-28 15:42:07,396] INFO - r.artifacts.impl.HttpDiskCache - Finished cleaning up expired items, 0 items removed
[2018-09-28 15:42:07,396] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/temp/.old
[2018-09-28 15:42:07,396] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/work/.old
[2018-09-28 15:42:07,416] INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)
[2018-09-28 15:47:07,395] INFO - r.artifacts.impl.HttpDiskCache - Cleaning up items with life time in cache greater than 172800 seconds
[2018-09-28 15:47:07,396] INFO - r.artifacts.impl.HttpDiskCache - Finished cleaning up expired items, 0 items removed
[2018-09-28 15:47:07,396] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/temp/.old
[2018-09-28 15:47:07,396] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/work/.old
[2018-09-28 15:47:07,421] INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)
[2018-09-28 15:52:07,395] INFO - r.artifacts.impl.HttpDiskCache - Cleaning up items with life time in cache greater than 172800 seconds
[2018-09-28 15:52:07,396] INFO - r.artifacts.impl.HttpDiskCache - Finished cleaning up expired items, 0 items removed
[2018-09-28 15:52:07,396] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/temp/.old
[2018-09-28 15:52:07,396] INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/work/.old
[2018-09-28 15:52:07,420] INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)

0
2 comments

Server logs:

[2018-09-28 15:31:33,510] INFO - jetbrains.buildServer.AGENT - Removing authorization token '' from agent with no name: "" {id=0, protocol=unidirectional, host=172.17.0.3:9090, agentTypeId=0, registered since 2018-09-28 15:31:33.503}
[2018-09-28 15:31:33,573] INFO - jetbrains.buildServer.AGENT - Set generated name "ip_172.17.0.3" to agent "" {id=1} as it had no name defined.
[2018-09-28 15:31:33,601] INFO - jetbrains.buildServer.AGENT - New agent authorization token "c359129ac22152811a9c1b725207a4c8" was generated for agent "ip_172.17.0.3" {id=1}
[2018-09-28 15:31:33,760] INFO - jetbrains.buildServer.AGENT - Upgrade of agent "ip_172.17.0.3" {id=1} has been scheduled, agent version: 58537, plugins signature: NA. Current version: 58537, plugins signature: 58537-md5-8727fbe0ae56b7cf9751d53d44f0d141
[2018-09-28 15:31:33,860] INFO - jetbrains.buildServer.AGENT - Agent has been registered: "ip_172.17.0.3" {id=1, protocol=unidirectional, host=172.17.0.3:9090, agentTypeId=1, pool=Default, registered since 2018-09-28 15:31:33.503}, not running a build
[2018-09-28 15:31:33,884] INFO - ldServer.AGENT.PollingProtocol - Polling Agent session 'le1wQej...' was created, agent: "ip_172.17.0.3" {id=1}
[2018-09-28 15:31:34,005] WARN - jetbrains.buildServer.AGENT - Agent "ip_172.17.0.3" {id=1} is unauthorized on registration
[2018-09-28 15:31:34,541] INFO - jetbrains.buildServer.AGENT - Agent "ip_172.17.0.3" {id=1} has confirmed upgrade.
[2018-09-28 15:31:35,265] INFO - ldServer.AGENT.PollingProtocol - Polling Agent session 'le1wQej...' was closed, agent: "ip_172.17.0.3" {id=1}
[2018-09-28 15:31:35,289] INFO - jetbrains.buildServer.AGENT - Agent "ip_172.17.0.3" {id=1} has been unregistered. Reason: Agent has unregistered (will upgrade)
[2018-09-28 15:32:07,648] INFO - jetbrains.buildServer.AGENT - Agent has been registered: "ip_172.17.0.3" {id=1, protocol=unidirectional, host=172.17.0.3:9090, agentTypeId=1, pool=Default, registered since 2018-09-28 15:32:07.383}, not running a build
[2018-09-28 15:32:07,666] INFO - ldServer.AGENT.PollingProtocol - Polling Agent session 'XIg9gBh...' was created, agent: "ip_172.17.0.3" {id=1}
[2018-09-28 15:32:07,794] WARN - jetbrains.buildServer.AGENT - Agent "ip_172.17.0.3" {id=1} is unauthorized on registration

0

Hi Denis,

 

how do you have this agent set up? Is it a regular agent or is it set up via a cloud profile?

 

The error of the "unauthorized (1)" display with an empty page is often related to just an UI issue, often when it has just changed state. Swapping to another tab should refresh that showing the actual current state. If you have recently upgraded, it might as well be a browser issue.

0

Please sign in to leave a comment.