RAR on CentOS 7

sudo rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
sudo yum -y install rar unrar

Change a homebrew app to previously installed version

If a previous version isn’t available via homebrew brew search (even after installing brew tap homebrew/versions) so you can’t switch via brew [un]link $FORMULA and you have installed it previously, do:

brew info $FORMULA
brew switch $FORMULA $VERSION

E.g., to downgrade phpmyadmin from 4.5.2, I used:

brew switch /usr/local/Cellar/phpmyadmin 4.3.4

See: homebrew Tips-N’-Tricks

(Of course you can also always manually update the symlink in /usr/local/share or update/create your own formula.)

Docker network info, linked containers

To see network info for Docker host, use the network (v1.9+) command:

docker network [OPTIONS] COMMAND [OPTIONS]

To link containers by name, you now need to use the –link command:

The docker network inspect command above shows all the connected containers and their network resources on a given network. Containers in this default network are able to communicate with each other using IP addresses. Docker does not support automatic service discovery on the default bridge network. If you want to communicate with container names in this default bridge network, you must connect the containers via the legacy docker run --link option.

If you upgraded your Docker host from pre 1.9 and your containers were not longer able to communicate, this is probably why.

$ docker run --rm -ti busybox ping my-container
ping: bad address 'my-container'
$ docker run --rm -ti --link=my-container busybox ping my-container
PING my-container (172.17.0.2): 56 data bytes
...

See https://docs.docker.com/engine/userguide/networking/dockernetworks/

And note:

While links are still supported in this limited capacity, you should avoid them in preference of Docker networks. The link feature is expected to be deprecated and removed in a future release.

So also see: https://docs.docker.com/engine/userguide/networking/default_network/build-bridges/ etc.

Basic Docker usage stats

Display a live stream of container(s) resource usage statistics:

docker stats [OPTIONS] CONTAINER [CONTAINER...]

To see all running containers:

docker stats $(docker ps -q)

Iptables see specific table rules

See specific table rules for iptables — otherwise filter table is used. Add -v for more info.

iptables --table nat --list

Redis Docker container

Easy Docker set-up using pre-built image:

(Ubuntu host in this example, but others should be similar)

# see https://hub.docker.com/_/redis/

Docker run command:

docker run -d -v $(pwd)/redis.conf:/usr/local/etc/redis/redis.conf \
 -v /data/redis:/data -p 6379:6379 \
 --restart="always" \
 --name myredis redis:3.0.3 redis-server /usr/local/etc/redis/redis.conf
  • On docker host, create data volume so we aren’t reading/writing on the container:
    make sure this path is in the redis.conf file
  • sudo mkdir /data/redis && sudo chown ubuntu:docker $_ && sudo chmod g+w $_

  • if you get this warning:
    WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
    > update Docker host:
    echo never > /sys/kernel/mm/transparent_hugepage/enabled

  • redis force save data file to disk command to test external volume:
    BGSAVE

    security issues:

  • add authentication if needed and check it on remote clients
  • set firewall: (ubuntu example where eth1 is LAN)
    ufw allow in on eth1 to any port 6379 proto tcp

    If you want to bake-in your config file or set other customizations, create Dockerfile:

    FROM redis:3.0.3
    COPY ./redis.conf /usr/local/etc/redis/redis.conf
  • « Previous Entries