question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Support Both entrypoint and command with Simplified Default

See original GitHub issue

Proposal: Support Both entrypoint and command with Simplified Default

Author: Wong Hoi Sing Edison <@hswong3i>

Date: 2020-02-29

  • Status: New
  • Proposal type: core design, schema changes
  • Estimated time to implement: DONE (see #2591)

Motivation

For docker and podman driver, by default we only handle the command overwrite with sleep infinity.

Problems

In case base image have both ENTRYPOINT and CMD specified, our sleep infinity may not functioning correctly.

Solution proposal

For simple test case which we are NOT care about the base image original ENTRYPOINT and CMD, with this patch we will default it with '' and bash -c "sleep infinity" therefore generally working for Molecule:

platforms:
  - name: instance
    image: centos:7
    entrypoint: ''
    command: 'bash -c "sleep infinity"'

In case we ARE caring about the base image origin ENTRYPOINT and CMD (e.g. mariadb:10.4), just simply set them as ~ in order to resume the original behavior:

platforms:
  - name: instance
    image: mariadb:10.4
    entrypoint: ~
    command: ~

When combine with systemd based container we could specify ENTRYPOINT and CMD as init and bash -c "sleep infinity", therefore much similar as real world production use cases:

platforms:
  - name: instance
    image: centos:7
    privileged: true
    volumes:
      - "/sys/fs/cgroup:/sys/fs/cgroup:rw"
    entrypoint: init
    command: 'bash -c "sleep infinity"'
    tty: True
    environment:
      container: docker

Dependencies (optional)

N/A

Testing (optional)

Corresponding test cases updated (see #2591; moreover, CI passed)

Documentation (optional)

Corresponding documentation updated (see #2591)

Anything else?

Ultimately, if we docker commit the result container as a static image with original base image’s ENTRYPOINT and CMD during verify.yml, we could therefore push this brewed image hub.docker.com as an alternative of ansible-bender project with standard Ansible supporting.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hswong3icommented, Mar 2, 2020

Can we make molecule working for both without forcing the user to add special configuration options to the molecule file?

@ssbarnea Yes, this is now confirmed to be functioning, see https://github.com/ansible-community/molecule/issues/2593#issuecomment-592954898

0reactions
ssbarneacommented, Oct 20, 2020

Closing as this is something container/driver specific and we no longer keep these drivers in core molecule.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Docker's CMD and ENTRYPOINT Instructions
Technically, ENTRYPOINT supports both the ENTRYPOINT ["command"] syntax and the ENTRYPOINT command syntax. However, while both of these are ...
Read more >
Docker entrypoint and cmd together - Stack Overflow
When you use both entrypoint and command, the command section will be appended to entrypoint executable as arguments. Thus in your case:
Read more >
Demystifying ENTRYPOINT and CMD in Docker - AWS
So when we declare both an ENTRYPOINT and a CMD , and ENTRYPOINT is a list, the two are concatenated together to form...
Read more >
Dockerfile reference - Docker Documentation
If CMD is used to provide default arguments for the ENTRYPOINT instruction, both the CMD and ENTRYPOINT instructions should be specified with the...
Read more >
Dockerfiles, CMD, ENTRYPOINT and input syntax
The default command of this container is ["/entrypoint.sh"], with params ["python", "agent.py"] # both command and params can be overriden
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found