Skip to content

Commit

Permalink
everything added for now
Browse files Browse the repository at this point in the history
  • Loading branch information
thevasudevgupta committed Jul 17, 2020
1 parent 6bf164d commit 1a32375
Show file tree
Hide file tree
Showing 39 changed files with 1,001 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# ds-toolkit
This repo is involving some handy stuff which every data scientist should know.

This repo is involving some handy stuff which every data scientist should know. These tools are realy handy to use for any data science project.

- [Markdown](markdown)
- [Git Notes](git-notes)
- [docker-notes](docker-notes)

## Contributions
I got these awesome git-notes and markdown intro files from [Mukund's](https://github.com/MukundVarmaT/GIT-notes) Repo

## Feel free to contribute to this repo

22 changes: 22 additions & 0 deletions docker-notes/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# specify the base image
FROM ubuntu

# this command line will be simply executed while creating image
RUN apt-get update && apt-get install -y python python3-pip sudo

RUN sudo apt install git

# RUN useradd -m vasudevgupta

# RUN chown -R vasudevgupta:vasudevgupta /home/vasudevgupta/

# this will copy whatever in my current dir to my image directory
COPY . /home/vasudevgupta/files/

# USER vasudevgupta

# this command will be executed when container is ran
CMD ['lets learn how to use this awesome tool']

WORKDIR /home/vasudevgupta/files/

11 changes: 11 additions & 0 deletions docker-notes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Docker

This repo contains small explaination of how docker works and some very handy command for using docker.

## Suggested Order of Reading
- [Introduction](docker-intro.md)
- [Docker Images](images.md)
- [Docker Containers](containers.md)
- [Pipeline for doing things](pipeline.md)

### Feel free to make pull request to contribute/ add something. Don't hesitate to raise an issue to correct me, if i am wrong somewhere.
31 changes: 31 additions & 0 deletions docker-notes/containers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Containers

Containers are simply running instances of images. (You can think of them as instances of objects; just like what we have in object oriented python )

Whenever you run the image; a new container is created and it is what is actually running

## Lets play around
In this section, we will be creating containers and you can do it simply by running images
- `docker run -it <image_name>` <br>
It is useful to initialize docker by a name. This becomes handy, if you want to play with the container. This you can do simply by following command:
- `docker run -it --name <specify_container_name> <image_name>`

Now a container is created and you can play around with containers using following commands
- `docker ps`
this will show some details of the containers which are currently running
- `-a` this flag can be used to access all the containers (whether running or stopped)
- `-q` this is for getting only the ids for the containers
- `--help` this is handy for learning about other possible options

## Some handy commands
- `docker start <container_id/container_name>`
- `docker pause <container_id/container_name>`
- `docker attach <container_id/container_name>`
- `docker unpause <container_id/container_name>`
- `docker stop <container_id/container_name>`

## Now lets explore about removing the containers
- `docker rm <container_id/container_name>` <br>
Now a useful trick to remove multiple containers using a single command
- `docker rm $(<containers_ids>)`; <br>
`<containers_ids>` can be access like that `docker ps -q` or any other way
5 changes: 5 additions & 0 deletions docker-notes/docker-compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# docker-compose

docker-compose up

docker-compose down
12 changes: 12 additions & 0 deletions docker-notes/docker-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Docker

Docker is very handy and nice tool which can be used to maintain different version of your projects. It can be very handy to manage your projects and make it easy to run your files onto someone else machine/OS.

## Very basic commands
- `docker --version`
handy command to check the version of your docker
- `docker system df`
This command can be useful to see memory usage by docker and to see overall statistics about your images and containers

## Installation
You can refer [docker official website](https://www.docker.com/get-started) for setting up docker in your system.
15 changes: 15 additions & 0 deletions docker-notes/images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Images

Images are the light weight operating system kind of. Whatever we code, we can simply build images which will contain all the dependenices to execute that code. Now we can simply run the complete code using docker without worring about installing various requirements or changing things when shifting to different operating system.

They are broadly classified into 2 categories:
- Base Class: this mainly consist of images which is made from scratch image. This typically includes images of OS.
- Child Class: this is images which are made using base class images. This typically includes images which users create.

## lets pull docker image from dockerhub
- `docker pull <image_name:tag>` <br>
This is how we can simply use the base class / child class image by getting it from dockerhub

## Further Readings
- I have discussed about running image in the [container section](containers.md)
- I have discussed about creating image in the [pipeline section](pipeline.md)
38 changes: 38 additions & 0 deletions docker-notes/pipeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Pipeline

Lets see about creating our own custom images.

## Create Dockerfile
You can easily do by running following command in terminal: <br>
- `touch Dockerfile`
I will talk about adding stuff in Dockerfile in some other file.

## Create image
- `docker build -t <docker_user_name>/<specify_image_name>:<tag_name> .` <br>
Note:
- above `<tag_name>` is optional; If you don't specify that, `latest` tag will get associated to the image
- `.` this simply represent the directory in which Dockerfile is present. You can specify path other way as well

## Run image
You can simply run this image; just like we did it earlier.

## Updating Images with containers
Now that you have created the container; what if you want to save that configuration as a updated image
- `docker commit -m <write_some_message> <container_name/container_id> <docker_user_name>/<image_name/image_id>:<tag_name>` <br>
Above command will simply update the previous image (if same name is given) or create the new image (otherwise)

## Push image to DockerHub
This step is optional. Its just like pushing files to github; but here you push and pull images instead. Here is command to do that actually:
- `docker push <docker_user_name>/<specify_image_name>:<tag_name>`

## Deleting Images
Now that we have learnt about creating images; lets see the best practice for deleting images:
- Stop the containers first (since containers are the running instance of images)
`docker stop <container_name/container_id>`
- Delete the containers
`docker rm <container_name/container_id>`
- Delete the image
`docker rmi <image_name/image_id>`

## Additional Note:
- If you choose to name the image as `<specify_image_name>:<tag_name>` instead of `<docker_user_name>/<specify_image_name>:<tag_name>`. Then you need to first tag that image in this particular fashion. and one extra copy will be created. so its best practice to specify the `<docker_user_name>` in first go.
10 changes: 10 additions & 0 deletions git-notes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# GIT

Knowing to use GIT from command line and the basic terminologies is essential for any developer. Here is a small compilation of essential commands you must know.

- [What is GIT](git-intro.md)
- [Command line usage](git-commands.md)
- [Useful extensions and ease of life methods](git-ease.md)
- [Merging vs Rebase (when you should do what?)](git-mergevsrebase.md)
- [Revert, Reset and checkout](rev-res-check.md)
- [References and the Reflog](ref-reflog.md)
Binary file added git-notes/assets/checkout1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added git-notes/assets/checkout2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added git-notes/assets/checkout3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions git-notes/assets/checkout4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1a32375

Please sign in to comment.