docker / docker/docker-py

Documentation isn't very clear for docker service command attribute

Open
#2,437 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

It's not really a fault in the library but more how docker services and docker containers uses different words for the same thing... There's a logical explanation but it's pretty misleading.
I was making docker image that would run as root to install packages then it would call a command with "su" with a different user to make the command not superuser.

But then I realized my command was being run as root because of a warning that the process was using root as user...
Then I realized the created containers had all the "entrypoint" defined as the command. After searching a bit I came to the conclusion that the library wasn't at fault and that was a misunderstanding on my part.

Here the official documentation isn't so clear on this either.

https://docs.docker.com/engine/api/v1.24/#39-services

As I understand, in docker service words, the command is this:

output_command = command + args

But in reality, you cannot override if you only specify command

And in docker container words https://docs.docker.com/engine/reference/commandline/container_run/

output_command = entrypoint + [command + args]

So to make it clear, docker service command will become the docker container entrypoint and the docker service args will become the docker container command.

For some reason I assumed that docker would use the same semantic and have entrypoint on the service too but it would be cool to include in the docs that it's really not the same thing.

As a result anyone doing the same thing as I did, will simply override the entrypoint and will have weird issues if the service depends on them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the linked Docker services and container_run documentation, then locate the repository documentation for the service command attribute. Clarify the command and args semantics and explain how they relate to entrypoint and command; done when a reader can understand the distinction without relying on Docker's external terminology.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
devops, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.