DIR Return Create A Forum - Home
---------------------------------------------------------
knowledge-space
HTML https://sravanks.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Docker
*****************************************************
#Post#: 28--------------------------------------------------
Docker basic commands
By: sravan Date: October 26, 2017, 5:43 am
---------------------------------------------------------
[attach=1]
Note : if you are a root user, then the cursor will be "#".
In Other words if cursor is "#", then the user is root user
If it is "$", it is non root user.
If you are non root user, then you have to use "sudo" infront of
every docker command.
1. sudo docker ps
ps : processess snapshot
2. sudo docker ps -a
a = all
3. sudo docker images
4. sudo docker rmi {imageName}
rmi = remove image
5. sudo docker rm {conatainer id/names}
rm = remove
6. sudo docker pull ubuntu
Pull = will check locally. If it did not find, then pull pulls
image from dockerhub
7. sudo docker run -d ubuntu sleep 20
-d = (detached mode) run the command in background
8. sudo docker run -ti ubuntu bash
-ti = is most useful for the docker exec command.
-i - interactive - connects STDIN to the allocated terminal. Any
command you enter after this via your keyboard goes into the
terminal
8. sudo docker exec -ti CONTAINER bash
exec = executes a command on a running container
you can enter any running docker container by running
9. cat /etc/*release*
you can use the above command once you are in any container
10. docker attach {name}
when you used docker run -d ... the console is detached of
current console (console running in backgroud of that
container).
if you want to attach or bring that in foreground , then you
have to use docker attach {name}
*****************************************************