Skip to content

Instantly share code, notes, and snippets.

@binario200
Last active May 2, 2018 19:58
Show Gist options
  • Save binario200/e31eda282c670b26bbba50f0c31883d9 to your computer and use it in GitHub Desktop.
Save binario200/e31eda282c670b26bbba50f0c31883d9 to your computer and use it in GitHub Desktop.
# copyng files from an outside box to you directory
scp -i infolob-analytics.pem ubuntu@54.147.173.72:/home/ubuntu/.pm2/logs/index-out-0.log .
# running image, configuring port, environment var
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=visualuser -e POSTGRES_USER=visualuser -d postgres
# running a continaer and attaching it
docker run -i -t centos
# unused containers
docker rm $( docker ps -q -f status=exited)
# Delete all dangling (unused) images
docker rmi $( docker images -q -f dangling=true)
#to navigate over the volumes created local
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
then /var/lib/docker/volumes/jenkins-data/_data
// create you account at docker hub
https://hub.docker.com
// testing docker basics
docker version
docker info
docker ps
docker images
// searching for images
docker search ubuntu
// pulling a image
docker pull ubuntu:latest
// checking if the images it was pulled
docker images
// build a image
docker build -t myimage:v1 .
//run the container
docker run -it myimage:v1
// list exited containers
docker ps -a
// see the container statistics
docker stats containerID
//see the containers logs
docker logs containerID
//connecting to docker hub
docker login
Username: <username>
Password: <password>
Email: <email@com>
// that you image
docker tag you-image-name <YOUR_DOCKER_HUB_USERNAME>/myimage
// example
// docker tag binario200:v1 binario200/myimage
// push you image
docker push <YOUR_DOCKER_HUB_USERNAME>/myimage
//example
docker push binario200/myimage
FROM ubuntu:latest
RUN apt-get update && apt-get install -y tree
RUN mkdir /mydir
ENV HOSTNAME mycontainer
WORKDIR /mydir
CMD ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment