Skip to main content
17 votes
Accepted

How to keep configuration files automatically during apt-get upgrade or install?

There are options you can pass through apt-get to dpkg that will handle the config choices. We usually do something like: apt-get install -y --no_install_recommends -o Dpkg::Options::='--force-...
Jiri Klouda's user avatar
  • 5,837
6 votes
Accepted

Interference of Docker CMD with su: works with su-exec but not with su?

wrong argument order to su $ZOO_USER needs to be the first argument to su with the "$@" coming afterwards. su -c "$0" "$ZOO_USER" "$@" It is ok for the options to come before the username. It is a ...
chicks's user avatar
  • 1,893
5 votes
Accepted

docker: Error response from daemon: Conflict. The container name "/basexhttp" is already in use by container

You're attempting to create two different containers, each with the same name. Each time you execute docker run it will create a container, and you've named the containers the same with --name ...
BMitch's user avatar
  • 3,410
4 votes
Accepted

How to pass Gitlab env var with sensitive characters to bash script?

Surprisingly indeed GitLab works weirdly with the env vars. It evaluates them internally, though it shouldn't in my view. Value set as (in project Settings > CI/CD > Variables): 'aaa$bbb*%' becomes '...
Ivan's user avatar
  • 156
4 votes
Accepted

How can I get the Docker target platform inside the Build Environment / Dockerfile

This is typically done with a script, not the Dockerfile. The script (perhaps in bash or python) can run at build time to determine what environment it is in, and act accordingly. This can be included ...
Bruce Becker's user avatar
  • 3,743
4 votes
Accepted

Why does Jenkins Pipeline script returnStatus value not match status examined in shell?

There's a few things to note. First is that in the absense of a shebang being supplied, the actual interpreter that will be used is actually "sh", not "bash". Taking a look at the ...
Kyanar's user avatar
  • 150
3 votes
Accepted

Is \u the only way to output the user from .bashrc?

With the release of macOS Catalina (10.15) Apple has switched to Zsh as default shell (instead of Bash). Instead of setting PS1 in Bash you can set PROMPT in Zsh: PROMPT="${orange}%n"
Paidhi's user avatar
  • 326
3 votes
Accepted

npm not found but installed from the shell script file in Dockerfile

The issue is that prereqs-ubuntu.sh uses bash to install the npm. While the RUN directive uses sh to run the commands. Where is the npm installed root@2cd4a6af90f4:/app# type npm npm is /root/.nvm/...
Yuri G.'s user avatar
  • 179
3 votes
Accepted

The right way to Ansiblically deploy environments directly from Github:

There is no "right" or "wrong". If the commands work when you type them in, then they work, and we won't keep you from doing it. Everything else is opinion. Sure, there are some best practices, for ...
AnoE's user avatar
  • 4,906
3 votes

Interference of Docker CMD with su: works with su-exec but not with su?

The su-exec program in this script is actually the Alpine version created by Natanael Copa. It is installed from the OP's Dockerfile on line 6. The Alpine su-exec program is a substitute for gosu. ...
andreswebs's user avatar
3 votes

Access vault secret from bash script

This mighty be a lengthy procedure but worth implementing, creating child tokens to fetch information from Vault Server. Execute following procedure at Vault Server. Create policy to restrict the ...
Here_2_learn's user avatar
3 votes

Access vault secret from bash script

The vault docs mention a -field parameter for the read subcommand. So you should be able to put this into a shell script: SECRET=$(vault read -field foo secret/mysecret) Other vault docs use the ...
chicks's user avatar
  • 1,893
3 votes
Accepted

How to make the Jenkins agent build then start the server?

You are running into a conflict between jenkins nature of making sure everything is done before a job is complete and your desire for some long-running things to be asynchronous. There is no right ...
chicks's user avatar
  • 1,893
3 votes
Accepted

How to create a "silent" MySQL docker container?

You can run the container in detached mode by passing -d or --detach with the run command: https://docs.docker.com/engine/reference/run/#detached-vs-foreground
Argyle's user avatar
  • 1,026
2 votes

Docker exec environment different to container shell

Please refer to bash initialization process. https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html In your Dockerfile, at lines 12-14 you are patching files, but do not activate ...
mvk_il's user avatar
  • 166
2 votes
Accepted

replacing values in shell script using sed

Negation to the rescue: sed -i "s/server.address=[^\ ].*\ /server.address=${SERVER_ADDRESS} /g" This is telling to search zero or more characters (.*) NOT matching whitespace ([^\ ]) up to the first ...
earizon's user avatar
  • 138
2 votes

Add mapping ip and host into /etc/hosts with docker

You could try to use docker compose and the docker compose "extra_hosts" tag, as described on the docker compose specification at https://docs.docker.com/compose/compose-file/. extra_hosts Add ...
triplem's user avatar
  • 121
2 votes
Accepted

Automatically write new bash history to change-log file

Try using GNU Screen or Tmux. These are called "screen multiplexers" but you'd get a number of benefits The commands you run will continue running even if you disconnect, or you have network related ...
hayalci's user avatar
  • 136
2 votes
Accepted

Automating the creation of an Apache virtual-host file specifically

This has already been covered a bit in the comments, but I figured I'd lay out a more extensive answer. Is there a way to automate that / shorten the amount of lines code (the actual script-file is ...
Xiong Chiamiov's user avatar
2 votes
Accepted

How do I add my IP address to the start of my terminal using the bashrc file?

Well... you would need to know what IP address you actually want. Is it a public IP address? Is it a private subnet address? Do you only have 1 IP address? A few things you would need to figure out. ...
hvindin's user avatar
  • 1,754
2 votes

How to pass Gitlab env var with sensitive characters to bash script?

This is not answering only the question but also a bit more (I put this here for reference): I found out a decent way to tackle this and some complications coming afterwards... (after hours and hours ...
TeNNoX's user avatar
  • 121
2 votes
Accepted

How can I use bash functions in makefile?

One possible issue is that the NVM install script only writes the commands to set itself up to either .bash_profile OR .bashrc. Depending on your systems configuration, it may only be setup for ...
Turnip's user avatar
  • 63
2 votes
Accepted

cannot get bash prompt: Error response from daemon: Container foo is not running

Whoever created basex/basexhttp:latest does not seem to know Docker very well. They copied files necessary to a directory that was later configured as a volume, which means it can only be bound to an ...
Konrad Botor's user avatar
2 votes

How can I get the Docker target platform inside the Build Environment / Dockerfile

One other option is to use TARGETPLATFORM as mentioned but with multistage Dockerfile. If there's no complex logic apart from a few different steps (between targets), this allows to keep everything in ...
Filipe Pina's user avatar
2 votes

How to modify/allow firewall rules of a GCP instance directly from the CLI?

Most probably, you are using the wrong account. Find out which one you are currently using in CLI: gcloud config configurations list gcloud auth list If the selected configuration is wrong, fix it ...
xy2's user avatar
  • 181
1 vote

Defining and using bash functions in AWS CodeBuild

Bash functions (even when exported) are not preserved across commands steps. This is in contrast to exported env variables, so it seems AWS is doing some shenanigans behind the scenes to prevent it. I ...
David Ongaro's user avatar
1 vote
Accepted

SSH connection to jenkins server

Your configuration refers to a file that is local on your system, but does not exist on the jenkins server. The error message is trying to tell you this. /c/Users/D35N/Downloads/GitHubProjeckt/...
chicks's user avatar
  • 1,893
1 vote
Accepted

create entry-point script to get all env variables starting with VUE_APP_ and take it's value

While it's not clear what your trying to do (the script you have so far for the bit you are having trouble with would probably be handy), I think you are essentially just trying to parse your ...
hvindin's user avatar
  • 1,754
1 vote

Exit a Makefile target called by parent without throwing an error

Makefile all: test dosomething test: @echo "hello" dosomething: @if [ "a" = "a" ]; then\ echo "world";\ exit 0;\ fi Running: make will return: hello world
030's user avatar
  • 13.3k
1 vote

Running consul in the background using Chef

The usual way to do that is to use a service manager (systemd or supervisord) to handle the service lifecycle (keeping the consul program running and restarting it if it fails for exemple) there's ...
Tensibai's user avatar
  • 11.4k

Only top scored, non community-wiki answers of a minimum length are eligible