Last active
March 21, 2020 10:00
-
-
Save seksitha/54d24f84b0d9c72f8614247fe1a7a8bc to your computer and use it in GitHub Desktop.
git command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// just the general docker command learned so foar | |
docker version | |
cocker info | |
docker container ls or docker ps // list container active | |
docker container ls -a // list all container | |
docker container run -it -p 80:80 nginx // ex create container nginx. run is to install create container from local cache or pull from hub. -it mean interactive , | |
docker exec -it <CONTAINER_ID> bash // access command line of container | |
docker container rm 96a [id2] [id3] // to remove docker container is to docker rm <first-3digit-id-image-here> | |
docker container stop [ID] // stop container | |
docker stop $(docker ps -aq) // stop all | |
# REMOVE CONTAINERS | |
docker container rm $(docker ps -aq) // remove all container | |
docker rm $(docker ps -a -q) // Remove all stop container | |
# to Save space remove image that is not associate with running container | |
docker image prune --all -a | |
docker images // we only rm container not image we can see that by | |
docker rmi $(docker images -a -q) // remove all image | |
docker rmi [id] | |
docker container run -d -p 3306:3306 --name mysql --env MYSQL_ROOT_PASSWORD=123456 mysql // with environment variable | |
docker container run -p 80:80 -v $(pwd):/usr/share/nginx/html nginx // bind to current directory to (html dir) | |
// Build image from Dockerfile | |
// Dockerfile | |
FROM nginx:latest # Extends nginx so everything included in that image is included here | |
WORKDIR /usr/share/nginx/html | |
COPY . . | |
// End dockerfile | |
docker image build -t [image-name] . // dot mean build from dockerfile in current directory | |
docker container run -it -p xxxx:xx [image-name from build] // ext-port:in-port | |
// for docker-compose | |
// need to create composefile.yml and Cockerfile then | |
docker-compose up | |
// to start if you make chage need to | |
docker-compose up --build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/adamjohnson/5682757 this is the link when your pc does not have ssh key and permision diny | |
// git pull origin master --allow-unrelated-histories // to get remote update to date before add thing in | |
# in vindow we can use git this way and we get all linux command yehh | |
C:\Program Files\Git\git-bash | |
### | |
git init | |
git config --global user.name 'sek sitha' | |
git config --global user.email 'seksitha@gmail.com' | |
# add a repo online : note: can't add repo by command line. | |
git remote add origin git@github.com:seksitha/pdc-finance-api.git | |
# setup git ignore before git add . | |
git add . // add everything | |
git commit . -m 'commit to repos' or | |
git commit -a -m 'commit all new/changed files) | |
git status // see what is added | |
git push -u origin master | |
git ls-files #checking the files three in the repos | |
# after working and when you want to push to the server | |
git add newfile | |
git commit newfile -m 'somecomment' | |
git push origin master | |
# if you want to push to other branch | |
git checkout oringin myorigin | |
git push origin myorigin | |
// dangerous will remove local file. to undo is to use git stash or git pop is the undo git stash. | |
git rm -r <folder name> <or file> | |
# git remove does not work just do the follow | |
rm -rf .git // dangerous as it will wipe out the commit history. | |
git init # reinit | |
# add gitignore along the way | |
git rm --cached <ignored directory or file> // dot mean all if you just do one file maybe the file name | |
# then add the directory or file to gitignore file. | |
git add . | |
git commit -m 'remove x file' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment