docker exec
aka attach in a another way:
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a844002d4f17 centos:7 "bash" 7 minutes ago Up 7 minutes reverent_pike
then from another terminal:
# docker exec -t -i a844002d4f17 /bin/bash
[root@a844002d4f17 /]#
[root@a844002d4f17 /]#
Docker import
# docker import - centos7:vogsphere < a.tar
# docker run -t -i --rm centos7:vogsphere bash
# tar c - . | docker import - centos68:rpmbuild
docker export
# docker export jovial_hamilton > centOS68.rpmbuild.tar
run
# docker run -t -i --rm centos:latest bash
copy files
# docker cp amazing_kowalevski:/root/rpmbuild/SPECS/bind.spec .
Attach a device
[~]> docker run -t -i --rm --device=/dev/sdb centos:latest bash
# sudo docker rm $(docker ps -a -q)
port
docker run -t -i --rm -p 127.0.0.1:8889:8889 .....
volume
# docker run -t -i --rm -v /backup/btrfs_librenet/var/lib/pgsql:/var/lib/pgsql centos7:librenet bash
commit
# docker commit -p -m "archlinux base-devel" -a "Evaggelos Balaskas <Evaggelos _ AT _ Balaskas _ DOT _ GR>" 31bcb9b9149e archlinux:devel
inspect example
docker inspect cranky_wilson
the result
[{
"Args": [],
"Config": {
"AttachStderr": true,
"AttachStdin": true,
"AttachStdout": true,
"Cmd": [
"bash"
],
"CpuShares": 0,
"Cpuset": "",
"Domainname": "",
"Entrypoint": null,
"Env": [],
"ExposedPorts": {},
"Hostname": "f05b21b0518f",
"Image": "centos:latest",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OnBuild": null,
"OpenStdin": true,
"PortSpecs": null,
"StdinOnce": true,
"Tty": true,
"User": "",
"Volumes": {},
"WorkingDir": ""
},
"Created": "2014-09-14T20:56:01.13710001Z",
"Driver": "btrfs",
"ExecDriver": "native-0.2",
"HostConfig": {
"Binds": null,
"CapAdd": null,
"CapDrop": null,
"ContainerIDFile": "",
"Devices": [],
"Dns": null,
"DnsSearch": null,
"Links": null,
"LxcConf": [],
"NetworkMode": "bridge",
"PortBindings": {},
"Privileged": false,
"PublishAllPorts": false,
"RestartPolicy": {
"MaximumRetryCount": 0,
"Name": ""
},
"VolumesFrom": null
},
"HostnamePath": "/mnt/data/var_lib_docker/containers/f05b21b0518f05b1cf63c7768770125859b9587eca929d7a14cd2e05c173671b/hostname",
"HostsPath": "/mnt/data/var_lib_docker/containers/f05b21b0518f05b1cf63c7768770125859b9587eca929d7a14cd2e05c173671b/hosts",
"Id": "f05b21b0518f05b1cf63c7768770125859b9587eca929d7a14cd2e05c173671b",
"Image": "5b0a5e3f48628e72058dd27a0a0bef2520930095647f08d02968703cc53663e2",
"MountLabel": "",
"Name": "/cranky_wilson",
"NetworkSettings": {
"Bridge": "docker0",
"Gateway": "172.17.42.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"PortMapping": null,
"Ports": {}
},
"Path": "bash",
"ProcessLabel": "",
"ResolvConfPath": "/mnt/data/var_lib_docker/containers/f05b21b0518f05b1cf63c7768770125859b9587eca929d7a14cd2e05c173671b/resolv.conf",
"State": {
"ExitCode": 0,
"FinishedAt": "0001-01-01T00:00:00Z",
"Paused": false,
"Pid": 13950,
"Restarting": false,
"Running": true,
"StartedAt": "2014-09-14T20:56:02.807773341Z"
},
"Volumes": {},
"VolumesRW": {}
}