Use
sed '/#start/,/#end/replace_command'
For example, if the file is called myconfig, and you want to replace "allow" with "deny" in that section, you could say
sed '/#start/,/#end/s/allow/deny/' myconfig
example
sed -i -r "/<elasticConfig>/,/<\/elasticConfig>/s,<enabled>.+</enabled>,<enabled>false</enabled>," file.xml
The nice thing about the command above is that it shows a unified view of all options and takes into consideration any overrides that may have been applied.
To change the value of an option, ExecStart in this case, do the following:
[ec2-user@ip-10-0-46-113 ~]$ sudo systemctl edit docker
This will create the necessary directory structure under /etc/systemd/system/docker.service.dand open an editor (using the default editor configured for the user) to the override file. Add the section below into the editor:
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
It was necessary to clear out ExecStart using ExecStart= before setting it to the override value. This is only required for some options and most options in the configuration file would not need to be cleared like this
SYNOPSIS
get-login
[--registry-ids <value> [<value>...]]
[--include-email | --no-include-email]
OPTIONS
--registry-ids (string) A list of AWS account IDs that correspond to
the Amazon ECR registries that you want to log in to.
--include-email | --no-include-email (boolean) Specify if the '-e' flag
should be included in the 'docker login' command. The '-e' option has
been deprecated and is removed in docker version 17.06 and later. You
must specify --no-include-email if you're using docker version 17.06 or
later. The default behavior is to include the '-e' flag in the 'docker
login' output.
#!/bin/bash
servers="server1;server2;server3"
IFS=';' read -r -a array <<< "$servers"
rand=$[ $RANDOM % ${#array[@]} ]
echo ${array[$rand]}
t also adds complexity to the Dockerfile language when there are clear workarounds. Don't push so much config in the parent Dockerfile and leave if for the inheriting images instead. (aka: stop sourcing random images on docker hub :D)
Since docker 17.05 there is also a new way to do multi-stage builds that removes most of the need for this issue (this is a single Dockerfile):
FROM nginx AS source-image
FROM scratch
COPY --from=source-image / /
EXPOSE 80
STOPSIGNAL SIGTERM
CMD ["nginx", "-g", "daemon off;"]
EDIT: Forgot to say, the second solution squashes all previous layers. I don't think it's a big deal but it's good to know.
he Base Script
This bash "one-liner" displays all blob objects in the repository, sorted from smallest to largest.
For my sample repo, it ran about 100 times faster than the other ones found here.
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| awk '/^blob/ {print substr($0,6)}' \
| sort --numeric-sort --key=2 \
| cut --complement --characters=13-40 \
| numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
This will generate nice human-readable output like this:
...
0d99bb931299 530KiB path/to/some-image.jpg
2ba44098e28f 12MiB path/to/hires-image.png
bd1741ddce0d 63MiB path/to/some-video-1080p.mp4
Filtering
To achieve further filtering, insert any of the following lines before the sort line.
To exclude files that are present in HEAD, insert the following line:
| grep -vF "$(git ls-tree -r HEAD | awk '{print $3}')" \
To show only files exceeding given size (e.g. 1 MiB = 220 B), insert the following line:
| awk '$2 >= 2^20' \
Output for Computers
To generate output that's more suitable for further processing by computers, omit the last two lines of the base script. They do all the formatting. This will leave you with something like this:
...
0d99bb93129939b72069df14af0d0dbda7eb6dba 542455 path/to/some-image.jpg
2ba44098e28f8f66bac5e21210c2774085d2319b 12446815 path/to/hires-image.png
bd1741ddce0d07b72ccf69ed281e09bf8a2d0b2f 65183843 path/to/some-video-1080p.mp4
for user in $(aws iam list-users|jq '.Users|.[]|.UserName' -r); do echo $user;aws iam list-user-policies --user-name $user; done
To apply this lifecycle rule to all objects in the bucket, choose Next.
That's why wildcard was not working :D
Un peu fatiguant de ne pas pouvoir configurer ce genre de chose sur l'ELB directement...
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} ^http$
RewriteRule . https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
Quand on utilise une image comme celle là, il ne faut pas faire n'importe quoi comme installer des packages php5-extensions, ce n'est pas du tout prévu... Il faut suivre la doc et utiliser les outils mis à dispo sinon on se retrouve un Dockerfile qui n'a aucun sens...
Dans ma todo : migrer ces "choses" pour utiliser une image debian de base
wget -q https://registry.hub.docker.com/v1/repositories/debian/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}'
Amazon Elasticsearch access control may be based on IAM account with signed request mechanism
One way not to rewrite all applications is using such a proxy
Une bonne intro en Fr et en vidéo de VueJS