2015年11月27日 星期五

Docker @ CentOS 7.0


Reference :

https://docs.docker.com/
https://docs.docker.com/engine/userguide/basics/
http://philipzheng.gitbooks.io/docker_practice/content/
http://www.openfoundry.org/tw/tech-column/9319-docker-101
http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach



1. Installation


1. yum install docker

Note:
FirewallD
CentOS-7 introduced firewalld, which is a wrapper around iptables and can conflict with Docker.
When firewalld is started or restarted it will remove the DOCKER chain from iptables, preventing Docker from working properly.
When using systemd, firewalld is started before Docker, but if you start or restart firewalld after Docker, you will have to restart the Docker daemon.


2. service docker start (/bin/systemctl start  docker.service)

3. chkconfig docker on  (systemctl enable docker.service)


2. Image

1. Search image with CentOS
docker search centos
2. Download image
docker pull centos
3. List local image
docker images

3.Container

1. List all container
docker ps -a


2. Start / Stop / Restart a container
docker start|stop|restart container-id
3. List all container
docker ps -a
4. Init a container ( create and run )
docker run -dit --name myCentOS6 centos:centos6
5. Start / Stop / Restart a exist container
docker start|stop|restart container-id
6. Attach (go back) to a container
docker attach containuer-id
EX :
docker run -dit --name myCentOS6 centos:centos6
docker attach myCentOS6
 7. De-attach (leave) a container
in the container, ctrl+p then ctrl+q
EX :
docker run -dit --name myCentOS6 centos:centos6
docker attach myCentOS6
ctrl + p , ctrl + q
(if we use exit to leave the bash, the container will stop because we "close" the last container job)
 




8. Run a new job in a container
docker exec container-id job
EX:  docker run myCentOS6

9. show a container info
docker inspect container-id job
EX:  docker run myCentOS6






2015年11月19日 星期四

Create iOS Apple Push Services Handshake P12

Reference :
http://stackoverflow.com/questions/12585858/cannot-send-push-notifications-using-javapns-javaapns-ssl-handshake-failure

https://www.sslshopper.com/article-most-common-openssl-commands.html


1. Create Push Certificates in Apple Developer


2.  Download the private key P12 file which use to create APNs certificate from the keychain in mac
     ( mykey.p12 )

3.  Download the certificate from Apple Developer


( developer_identify.cer )


4.  use openSSL to generate the correct p12 file

Convert a DER file (.crt .cer .der) to PEM
openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM


Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
openssl pkcs12 -nocerts -in mykey.p12 -out mykey.pem


Convert a PEM certificate file and a private key to PKCS#12 (.pfx .p12)
openssl pkcs12 -export -inkey mykey.pem -in developer_identity.pem -out iphone_dev.p12