mirror of
https://github.com/yeasy/docker_practice.git
synced 2024-12-24 22:18:54 +00:00
Remove useless file _local
This commit is contained in:
parent
7b93ed069f
commit
3c40c84cde
@ -1,49 +0,0 @@
|
||||
# Some useful commands to use docker.
|
||||
# Author: yeasy@github
|
||||
# Created:2014-09-25
|
||||
|
||||
alias docker-pid="sudo docker inspect --format '{{.State.Pid}}'"
|
||||
alias docker-ip="sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
|
||||
|
||||
#the implementation refs from https://github.com/jpetazzo/nsenter/blob/master/docker-enter
|
||||
function docker-enter() {
|
||||
#if [ -e $(dirname "$0")/nsenter ]; then
|
||||
#Change for centos bash running
|
||||
if [ -e $(dirname '$0')/nsenter ]; then
|
||||
# with boot2docker, nsenter is not in the PATH but it is in the same folder
|
||||
NSENTER=$(dirname "$0")/nsenter
|
||||
else
|
||||
# if nsenter has already been installed with path notified, here will be clarified
|
||||
NSENTER=$(which nsenter)
|
||||
#NSENTER=nsenter
|
||||
fi
|
||||
[ -z "$NSENTER" ] && echo "WARN Cannot find nsenter" && return
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: `basename "$0"` CONTAINER [COMMAND [ARG]...]"
|
||||
echo ""
|
||||
echo "Enters the Docker CONTAINER and executes the specified COMMAND."
|
||||
echo "If COMMAND is not specified, runs an interactive shell in CONTAINER."
|
||||
else
|
||||
PID=$(sudo docker inspect --format "{{.State.Pid}}" "$1")
|
||||
if [ -z "$PID" ]; then
|
||||
echo "WARN Cannot find the given container"
|
||||
return
|
||||
fi
|
||||
shift
|
||||
|
||||
OPTS="--target $PID --mount --uts --ipc --net --pid"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
# No command given.
|
||||
# Use su to clear all host environment variables except for TERM,
|
||||
# initialize the environment variables HOME, SHELL, USER, LOGNAME, PATH,
|
||||
# and start a login shell.
|
||||
#sudo $NSENTER "$OPTS" su - root
|
||||
sudo $NSENTER --target $PID --mount --uts --ipc --net --pid su - root
|
||||
else
|
||||
# Use env to clear all host environment variables.
|
||||
sudo $NSENTER --target $PID --mount --uts --ipc --net --pid env -i $@
|
||||
fi
|
||||
fi
|
||||
}
|
Binary file not shown.
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script will update all local images
|
||||
# See: https://github.com/yeasy/docker_practice/blob/master/_local/pull_all.sh
|
||||
# Usage: pull_all
|
||||
# Author: yeasy@github
|
||||
# Create: 2014-09-23
|
||||
|
||||
for image in `sudo docker images|grep -v "REPOSITORY"|grep -v "<none>"|awk '{print $1":"$2}'`
|
||||
do
|
||||
sudo docker pull $image
|
||||
done
|
||||
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
# This script will upload all local images to a registry server ($registry is the default value).
|
||||
# This script requires the push_images, which can be found at https://github.com/yeasy/docker_practice/blob/master/_local/push_images.sh
|
||||
# Usage: push_all
|
||||
# Author: yeasy@github
|
||||
# Create: 2014-09-23
|
||||
|
||||
for image in `sudo docker images|grep -v "REPOSITORY"|grep -v "<none>"|awk '{print $1":"$2}'`
|
||||
do
|
||||
push_images $image
|
||||
done
|
||||
|
@ -1,47 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script will upload the given local images to a registry server ($registry is the default value).
|
||||
# See: https://github.com/yeasy/docker_practice/blob/master/_local/push_images.sh
|
||||
# Usage: push_images image1 [image2...]
|
||||
# Author: yeasy@github
|
||||
# Create: 2014-09-23
|
||||
|
||||
#The registry server address where you want push the images into
|
||||
registry=127.0.0.1:5000
|
||||
|
||||
### DO NOT MODIFY THE FOLLOWING PART, UNLESS YOU KNOW WHAT IT MEANS ###
|
||||
echo_r () {
|
||||
[ $# -ne 1 ] && return 0
|
||||
echo -e "\033[31m$1\033[0m"
|
||||
}
|
||||
echo_g () {
|
||||
[ $# -ne 1 ] && return 0
|
||||
echo -e "\033[32m$1\033[0m"
|
||||
}
|
||||
echo_y () {
|
||||
[ $# -ne 1 ] && return 0
|
||||
echo -e "\033[33m$1\033[0m"
|
||||
}
|
||||
echo_b () {
|
||||
[ $# -ne 1 ] && return 0
|
||||
echo -e "\033[34m$1\033[0m"
|
||||
}
|
||||
|
||||
usage() {
|
||||
sudo docker images
|
||||
echo "Usage: $0 registry1:tag1 [registry2:tag2...]"
|
||||
}
|
||||
|
||||
[ $# -lt 1 ] && usage && exit
|
||||
|
||||
echo_b "The registry server is $registry"
|
||||
|
||||
|
||||
for image in "$@"
|
||||
do
|
||||
echo_b "Uploading $image..."
|
||||
sudo docker tag $image $registry/$image
|
||||
sudo docker push $registry/$image
|
||||
sudo docker rmi $registry/$image
|
||||
echo_g "Done"
|
||||
done
|
Loading…
Reference in New Issue
Block a user