Docker is software that provides containers, which allows teams to emulate development environments. Docker began as an internal project, initially developed by dotCloud engineers.
Start useing docker
Full image
1
docker full <name>
Start container
1
docker run <container id/name>
Start a stopped container
1
docker start <container id/name>
Stop an already container
1
docker stop <container id/name>
Two ways to get into the container
docker attach
Causes the container to stop if exiting the inter action.
docker exec
Exit the container without affecting the operation.
func(t Time) Value() (driver.Value, error) { var zeroTime time.Time var ti = time.Time(t) if ti.UnixNano() == zeroTime.UnixNano() { returnnil, nil } return ti, nil }
func(t *Time) Scan(v interface{}) error { value, ok := v.(time.Time) if ok { *t = Time(value) returnnil } return fmt.Errorf("can not convert %v to timestamp", v) }
将数据库结构体中的类型改为 Time 类型
1 2 3 4 5 6 7
package model
type User struct { Name string`json:"name" gorm:"type:varchar(32);not null"` CreatedAt Time `json:"created_at" gorm:"type:timestamp"` UpdatedAt Time `json:"updated_at" gorm:"type:timestamp"` }
[root@mbasic ~]# mongo MongoDB shell version: 3.2.6 connecting to: test > use test switched to db test > db.auth('test1','test1') 1 > 创建一个dmp用户,对dmp数据库只读权限。 > use admin switched to db admin > db.auth('myUserAdmin','abc123') 1 > use dmp switched to db dmp >db.createUser( { user:"dmp1", pwd: "dmp1pass", roles: [{ role: "read", db: "dmp"}] } )