Skip to content

Instantly share code, notes, and snippets.

@codepedia
Last active March 19, 2017 05:18
Show Gist options
  • Save codepedia/bf286c118a613b5433b0 to your computer and use it in GitHub Desktop.
Save codepedia/bf286c118a613b5433b0 to your computer and use it in GitHub Desktop.
[root@dev-instance ~]# adduser zee
[root@dev-instance ~]# su - zee
[sudo] password for zee:
[root@dev-instance ~]# passwd zee
Changing password for user zee.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@dev-instance ~]# vim /etc/passwd
-bash: vim: command not found
[root@dev-instance ~]# su - zee
Last login: Sun Mar 19 04:52:09 UTC 2017 on pts/0
[zee@dev-instance ~]$ whoami
zee
[zee@dev-instance ~]$ users
root
[root@dev-instance ~]# gpasswd -a zee wheel
Adding user zee to group wheel
[root@dev-instance ~]# su - zee
Last login: Sun Mar 19 04:53:51 UTC 2017 on pts/0
[zee@dev-instance ~]$ wget -qO- https://get.docker.com/ | sh
[sudo] password for zee:
+ sudo -E sh -c 'sleep 3; yum -y -q install docker-engine'
warning: /var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-selinux-17.03.0.ce-1.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
Public key for docker-engine-selinux-17.03.0.ce-1.el7.centos.noarch.rpm is not installed
Importing GPG key 0x2C52609D:
Userid : "Docker Release Tool (releasedocker) <docker@docker.com>"
Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
From : https://yum.dockerproject.org/gpg
setsebool: SELinux is disabled.
libsemanage.semanage_direct_install_info: Overriding docker module at lower priority 100 with module at priority 400.
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker zee
Remember that you will have to log out and back in for this to take effect!
[zee@dev-instance ~]$ debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
[zee@dev-instance ~]$ sudo usermod -aG docker zee
[sudo] password for zee:
[zee@dev-instance ~]$ wget -qO- https://get.docker.com/ | sh
Warning: the "docker" command appears to already exist on this system.
If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.
If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.
You may press Ct
[zee@dev-instance ~]$ service docker start
Redirecting to /bin/systemctl start docker.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: zee
Password:
==== AUTHENTICATION COMPLETE ===
[zee@dev-instance ~]$
===========================================================================
[root@dev-instance ~]# docker pull mysql
# error because of the :tag at the end..git tag.
[root@dev-instance ~]# docker run --name mysqldb -e MYSQL_ROOT_PASSWORD=gcloud12345 -d mysql:tag
Unable to find image 'mysql:tag' locally
Trying to pull repository docker.io/library/mysql ...
Pulling repository docker.io/library/mysql
/usr/bin/docker-current: Tag tag not found in repository docker.io/library/mysql.
See '/usr/bin/docker-current run --help'.
[root@dev-instance ~]# docker run --name mysqldb -e MYSQL_ROOT_PASSWORD=gcloud12345 -d mysql
01f6c239c5f1a7406d4f0bf544427e72831e7a4a339624148e6f285985314777
[root@dev-instance ~]#
# now find the IP address of the machine.
[root@dev-instance ~]# docker run mysql
error: database is uninitialized and password option is not specified
You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
[root@dev-instance ~]#
#made a istake and had to "Docker rm mysqldb"
[root@dev-instance ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/mysql latest 22be5748ecbe 2 weeks ago 405.6 MB
[root@dev-instance ~]#
# as you see the tag is the controlled version
[root@dev-instance ~]# docker run --name mysqldb -e MYSQL_ROOT_PASSWORD=gcloud12345 -d mysql:latest
[root@dev-instance ~]# docker run -it --link mysqldb:mysql --rm mysql sh -c 'exec mysql -h 72.17.0.2 -P "3306" -uroot -p"gcloud12345"'
mysql: [Warning] Using a password on the command line interface can be insecure.
# find the ip affresss
root@dev-instance ~]# ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::42:1aff:fe93:ac7d prefixlen 64 scopeid 0x20<link>
ether 02:42:1a:93:ac:7d txqueuelen 0 (Ethernet)
RX packets 53 bytes 3324 (3.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7 bytes 426 (426.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# damnd it, that is how you login:
[root@dev-instance ~]# docker exec -it mysqldb mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
[root@dev-instance ~]# ls /var/lib/docker/containers/
0a6378a8923c186bde4ea8a17953882011978ec371a3f13de9af56250c29624e/ efc5db3a4062dd4806c42264e9493f3359fee8ef12a9d337a93e7589ad56586f/
a478735c8e25bb03886cb8ce77aabf6a3aceb4b37189b57872072c6dd904f672/
[root@dev-instance ~]# ls /var/lib/docker/
containers/ devicemapper/ image/ network/ swarm/ tmp/ trust/ volumes/
[root@dev-instance ~]# ls /var/lib/docker/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment