Add /etc/docker/daemon.json with this 192.168.1.1:5000 (registry IP and port), and restart docker
{
“insecure-registries”: [“192.168.1.1:5000″]
}
Add /etc/docker/daemon.json with this 192.168.1.1:5000 (registry IP and port), and restart docker
{
“insecure-registries”: [“192.168.1.1:5000″]
}
Error: docker pull does not work on insecure connection by default
Solution for Centos 7: Add –insecure-registry option
1. Edit /lib/systemd/system/docker.service:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket[Service]
EnvironmentFile=-/etc/sysconfig/docker
Type=notify
ExecStart=/usr/bin/docker daemon $other_args -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity[Install]
WantedBy=multi-user.target
2. Edit /etc/sysconfig/docker
other_args=”–insecure-registry registry_ip:port“
3. Restart docker daemon:
sudo systemctl daemon-reload
sudo service docker restart
1. Save docker image as a tar file:
docker save -o tar_filename image_name
2. Copy the tar file to new host and import the image from tar file:
docker load -i tar_filename
docker run image /bin/bash -c “cd /path/to/somewhere; python a.py”
To pull centos as a base image to build other docker images:
docker pull centos:centosX
Where X can be 5, 6 or 7
Command: docker run -p 5000:5000 registry
When stopping a docker with mongod daemon running using command:
docker stop
the next time you start the mongod docker, it will complain about unclean shutdown detected:
“Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery
instructions.”
Cause: “docker stop” use SIGTERM to kill mongod daemon, while it is recommended to use SIGINT
Solution:
docker kill -s INT
Error: docker run with Exited (1)
Cause: the CMD you run inside the docker exits with error
Solution: Check the error in docker log by these steps:
1. sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4c94eb133b4 dockername:latest “httpd” 55 seconds ago Exited (1) 54 seconds ago0.0.0.0:80->80/tcp webserver
2. sudo docker logs CONTAINER_ID
The following 2 commands will do the job:
sudo docker ps -a | grep ‘Exited’ | awk ‘{print $1}’ | xargs –no-run-if-empty sudo docker rm
sudo docker images | grep ‘none’ | awk ‘{print $3}’ | xargs –no-run-if-empty sudo docker rmi