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.

What if "apt-get" becomes an instruction?

See original GitHub issue

Inside a multi-line RUN instruction, lack of \ will lead missing of command and no exception will be raised.

Here is an example Dockerfile

FROM ubuntu:xenial

RUN apt-get install -y curl && \
    curl --silent --location https://deb.nodesource.com/setup_4.x | bash - && \
    apt-get install -y nodejs
    apt-get install -y build-essentials
    echo Hello

Now, echo is taken as an instruction, but apt-get is lost.

If apt-get can also be taken as an instruction, I can deal with this Dockerfile syntax error manually. If not, an exception is expected.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
limjcstcommented, Jan 9, 2020

This issue may be related to https://github.com/containerbuildsystem/dockerfile-parse/blob/47740325fb821af04c4c94cd4d59701cbcd3f194/dockerfile_parse/parser.py#L243

as apt-get does not match ^\s*(\w+)\s.

How about replace the regex with r'^\s*(\S+)\s+(.*)$'? In this way, Dockerfile error is left for the user to deal with.

0reactions
MartinBasticommented, Jan 10, 2020

That’s possible, at least all new code must pass flake8 testing, we have enabled stickler-CI to cover new things.

Fixed via #92

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does apt-get abort by itself, as though I'd pressed 'N'?
apt -get aborts when it wants interactive confirmation but can't read input from stdin. For example, anyone (with pending upgrades) can reproduce this ......
Read more >
APT-GET Command in Linux {Detailed Tutorial With Examples}
apt -get is a command line tool for interacting with the Advanced Package Tool (APT) library (a package management system for Linux distributions) ......
Read more >
Can I rollback an apt-get upgrade if something goes wrong?
Thus the need for a rollback. The short answer - you could use the following command: $ apt-get -s install $(apt-history rollback |...
Read more >
AptGet/Howto - Community Help Wiki
This command runs <command_string> under the control of auto-apt. If a program tries to access a file known to belong in an uninstalled...
Read more >
Apt-get not working within ubuntu dockerfile - Stack Overflow
Execute 'apt-get update' and 'apt-get install' in a single RUN instruction. This is done to make sure that the latest packages will be ......
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