Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When creating a container with a docker image, use the docker run.

Code Block
themeEmacs
docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]OPTIONIS :
          -a, --attach list             Attach to STDIN, STDOUT or STDERR
          --cpus decimal                Number of CPUs
          -m, --memory bytes            Memory limit
          -d, --detach                  Run container in background and print container ID
          -e, --env list                Set environment variables
          --env-file list               Read in a file of environment variables
          -i, --interactive             Keep STDIN open even if not attached
          --privileged                  Give extended privileges to this container
          -t, --tty                     Allocate a pseudo-TTY
          -u, --user string             Username or UID (format: <name|uid>[:<group|gid>])
          -v, --volume list             Bind mount a volume
          -w, --workdir string          Working directory inside the container

...

To create a container, use it as follows.

Code Block
themeEmacs
languagebash
# docker run -it -e MODE=shell --name altibase_test altitest:0.0 bash-----------------------------------------------------------------
     Altibase Client Query utility.
     Release Version 7.1.0.1.0
     Copyright 2000, ALTIBASE Corporation or its subsidiaries.
     All Rights Reserved.
-----------------------------------------------------------------
ISQL_CONNECTION = UNIX, SERVER = localhost
[ERR-910FB : Connected to idle instance]
Connecting to the DB server.... Connected.
 
 
TRANSITION TO PHASE : PROCESS
Command executed successfully.
 
DB Info (Page Size     = 32768)
        (Page Count    = 257)
        (Total DB Size = 8421376)
        (DB File Size  = 1073741824)
 
    Creating MMDB FILES     [SUCCESS]
 
    Creating Catalog Tables [SUCCESS]
 
    Creating DRDB FILES     [SUCCESS]
 
  [SM] Rebuilding Indices [Total Count:0]  [SUCCESS]
 ...
 
# ls
altibase_home  docker-entrypoint.sh  set_altibase.env

...

Code Block
themeEmacs
-v [host directory path]:[container directory path]
or
--mount type=[OPTIONS],source=[host directory path],target=[container directory path]
Code Block
themeEmacs
# docker run -it --name altibase_test \--privileged \
-v ~/work/ALTIBASE_DBS:/home/altibase/altibase_home/dbs \
-v ~/work/ALTIBASE_LOGS:/home/altibase/altibase_home/logs \
altitest:0.0 /bin/bash

...

  1. Create Docker network
    Docker network is created with the docker network create command
    The created network can be checked with the docker network ls command, and details can be chedk checked with the docker inspect command.

    Code Block
    themeEmacs
    docker network create [OPTIONS] NETWORKOPTIONIS :
              --attachable               Enable manual container attachment
              --config-from string       The network from which copying the configuration
              -d, --driver string        Driver to manage the Network (default "bridge")
              --ipv6                     Enable IPv6 networking
              --label list               Set metadata on a network
     
    docker inspect [OPTIONS] NAME|ID [NAME|ID...]
    OPTIONIS :
              --format , -f       Format the output using the given Go template
              --size , -s         Display total file sizes if the type is container
              --type              Return JSON for specified type

    Create a Docker network with the name isolated_network.
    Check the created network with docker network ls.

    Code Block
    themeEmacs
    languagebash
    # docker network create --driver bridge isolated_network2bb4d1dc2fc364ed45e69beb3a8b257f5d0e9cd95b5e4676d819386b32ba88d6
     
    # docker network ls
    NETWORK ID          NAME                DRIVER              SCOPE
    09929baadcff        bridge              bridge              local
    1963af1259b9        host                host                local
    2bb4d1dc2fc3        isolated_network    bridge              local
    5f3deeb7fcba        none                null                local

    Check the details of the created work.

    Code Block
    themeEmacs
    languagebash
    # docker inspect 2bb4d1dc2fc3[
        {
            "Name": "isolated_network",
            "Id": "2bb4d1dc2fc364ed45e69beb3a8b257f5d0e9cd95b5e4676d819386b32ba88d6",
            "Created": "2019-10-29T09:50:37.6130865+09:00",
            "Scope": "local",
            "Driver": "bridge",
            "EnableIPv6": false,
            "IPAM": {
                "Driver": "default",
                "Options": {},
                "Config": [
                    {
                        "Subnet": "172.18.0.0/16",
                        "Gateway": "172.18.0.1"
                    }
                ]
            },
            "Internal": false,
            "Attachable": false,
            "Ingress": false,
            "ConfigFrom": {
                "Network": ""
            },
            "ConfigOnly": false,
            "Containers": {},
            "Options": {},
            "Labels": {}
        }
    ]

    2. Join the Docker network while creating the container of the master node.

    Code Block
    themeEmacs
    languagebash
    # docker run -it \--net=isolated_network \
    --hostname=master  \
    -e MODE=shell \
    -e MASTER_REP_PORT=30300 \
    --name altitest_master altitest:0.0 /bin/bash
    Required Options
    --netNetwork name on which container will be executed
    --hostnameHost nameHostname
    -e MASTER_REP_PORTReplication port number

    3. Join the master node's Docker network while creating a container for the additional node.

    Code Block
    themeEmacs
    languagebash
    # docker run -it \--net=isolated_network \
    --hostname=slave \
    -e MODE=replication \
    -e MASTER_HOST_NAME=master -e MASTER_DB_PORT=20300 -e MASTER_REP_PORT=30300 \
    -e SLAVE_HOST_NAME=slave -e SLAVE_REP_PORT=30310 \
    --name altitest_slave altitest:0.0 /bin/bash altibase
    Required options
    --netNetwork name on which container will be executed
    --hostnameHostname
    -e MASTER_HOST_NAMEHostname of the master node
    -e MASTER_DB_PORTService port number of the master node
    -e MASTER_REP_PORTReplication port number of the master node
    -e SLAVE_HOST_NAMEHostnmae of the slave node
    -e SLAVE_REP_PORTReplication port number of the slave node

    3. Join the master node's Docker network while creating a container for the slave node.

    Code Block
    themeEmacs
    languagebash
    # docker run -it \--net=isolated_network \
    --hostname=slave \
    -e MODE=replication \
    -e MASTER_HOST_NAME=master -e MASTER_DB_PORT=20300 -e MASTER_REP_PORT=30300 \
    -e SLAVE_HOST_NAME=slave -e SLAVE_REP_PORT=30310 \
    --name altitest_slave altitest:0.0 /bin/bash altibase
    Required options
    --netNetwork name of which container will be executed
    --hostnameHostname
    -e MASTER_HOST_NAMEHostname of the master node
    -e MASTER_DB_PORTService port number of the master node
    -e MASTER_REP_PORTReplication port number of the master node
    -e SLAVE_HOST_NAMEHostname of the slave node
    -e SLAVE_REP_PORTReplication port number of the slave node

    4. Check the network information.

    Code Block
    themeEmacs
    languagebash
    # docker inspect 2bb4d1dc2fc3
    [
        {
            "Name": "isolated_network",
            "Id": "2bb4d1dc2fc364ed45e69beb3a8b257f5d0e9cd95b5e4676d819386b32ba88d6",
            "Created": "2019-10-29T09:50:37.6130865+09:00",
            "Scope": "local",
            "Driver": "bridge",
            "EnableIPv6": false,
            "IPAM": {
                "Driver": "default",
                "Options": {},
                "Config": [
                    {
                        "Subnet": "172.18.0.0/16",
                        "Gateway": "172.18.0.1"
                    }
                ]
            },
            "Internal": false,
            "Attachable": false,
            "Ingress": false,
            "ConfigFrom": {
                "Network": ""
            },
            "ConfigOnly": false,
            "Containers": {
                "0ac2165ddda455343ba2b374f18575bfc8e39f51c7fdfc80bfa49482c76e79fe": {
                    "Name": "altitest_slave",
                    "EndpointID": "db9c1241f322019764f7af4781c359647ec393bfd29a816433e1c3184546b546",
                    "MacAddress": "02:42:ac:12:00:03",
                    "IPv4Address": "172.18.0.3/16",
                    "IPv6Address": ""
                },
                "964cd5ff922470b9131a23a399029844525aba39eaa500b9f4f3453b902c8461": {
                    "Name": "altitest_master",
                    "EndpointID": "80390d64486a6eabedc5cbf7e3d2fe9886099cae7678da7a9a55ef64a1130bf4",
                    "MacAddress": "02:42:ac:12:00:02",
                    "IPv4Address": "172.18.0.2/16",
                    "IPv6Address": ""
                }
            },
            "Options": {},
            "Labels": {}
        }
    ]

...

When connecting to the Altiabse server from inside the container, use the isql command

 

Code Block
themeEmacs
languagebash
# isql -s localhost -u [user account] -p [user password]# isql -s localhost -u sys -p manager
-----------------------------------------------------------------
     Altibase Client Query utility.
     Release Version 7.1.0.1.0
     Copyright 2000, ALTIBASE Corporation or its subsidiaries.
     All Rights Reserved.
-----------------------------------------------------------------
ISQL_CONNECTION = TCP, SERVER = localhost, PORT_NO = 20300
iSQL>

...

IP can be checked with the docker inspect command.

Code Block
themeEmacs
languagebash
# docker psCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
dbab08cc5be8        altitest:0.0        "/bin/bash /home/alt…"   18 hours ago        Up 18 hours         20300/tcp, 30300/tcp     altibase_test
19d325fa6e26        registry            "/entrypoint.sh /etc…"   2 days ago          Up 2 days           0.0.0.0:5000->5000/tcp   local-registry
 
# docker inspect altibase_test
[
    {
        "Id": "dbab08cc5be8aac2c005d9f8d1dbc0f0d0569e8c30c59a49fe455cdb06963484",
...
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "2436fb93d9e66afe8649a482775c95c14870d09dbee367a5ebd59695f98a0854",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "20300/tcp": null,
                "30300/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/2436fb93d9e6",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "8c2c73671de5b3a55251313f8bc6b1c376685e59feb3ed55163ab9692f85983d",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.3",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:03",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "3b3cdc53d9c0e6ad146b6c7bcc8cb60bcef01ba533fee3fd704e5959a1ef573f",
                    "EndpointID": "8c2c73671de5b3a55251313f8bc6b1c376685e59feb3ed55163ab9692f85983d",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:03",
                    "DriverOpts": null
                }
            }
        }
    }
]
Code Block
themeEmacs
languagebash
# isql -s [server IP] -u [user account] -p [user password]# isql -s 172.17.0.3 -u sys -p manager
-----------------------------------------------------------------
     Altibase Client Query utility.
     Release Version 7.1.0.1.0
     Copyright 2000, ALTIBASE Corporation or its subsidiaries.
     All Rights Reserved.
-----------------------------------------------------------------
ISQL_CONNECTION = TCP, SERVER = 172.17.0.3, PORT_NO = 20300
iSQL>