Wednesday, 4 September 2019

docker commands

Here is a list of docker commands.

Child commands
CommandDescription
docker attachAttach local standard input, output, and error streams to a running container
docker buildBuild an image from a Dockerfile
docker builderManage builds
docker checkpointManage checkpoints
docker commitCreate a new image from a container’s changes
docker configManage Docker configs
docker containerManage containers
docker contextManage contexts
docker cpCopy files/folders between a container and the local filesystem
docker createCreate a new container
docker deployDeploy a new stack or update an existing stack
docker diffInspect changes to files or directories on a container’s filesystem
docker engineManage the docker engine
docker eventsGet real time events from the server
docker execRun a command in a running container
docker exportExport a container’s filesystem as a tar archive
docker historyShow the history of an image
docker imageManage images
docker imagesList images
docker importImport the contents from a tarball to create a filesystem image
docker infoDisplay system-wide information
docker inspectReturn low-level information on Docker objects
docker killKill one or more running containers
docker loadLoad an image from a tar archive or STDIN
docker loginLog in to a Docker registry
docker logoutLog out from a Docker registry
docker logsFetch the logs of a container
docker manifestManage Docker image manifests and manifest lists
docker networkManage networks
docker nodeManage Swarm nodes
docker pausePause all processes within one or more containers
docker pluginManage plugins
docker portList port mappings or a specific mapping for the container
docker psList containers
docker pullPull an image or a repository from a registry
docker pushPush an image or a repository to a registry
docker renameRename a container
docker restartRestart one or more containers
docker rmRemove one or more containers
docker rmiRemove one or more images
docker runRun a command in a new container
docker saveSave one or more images to a tar archive (streamed to STDOUT by default)
docker searchSearch the Docker Hub for images
docker secretManage Docker secrets
docker serviceManage services
docker stackManage Docker stacks
docker startStart one or more stopped containers
docker statsDisplay a live stream of container(s) resource usage statistics
docker stopStop one or more running containers
docker swarmManage Swarm
docker systemManage Docker
docker tagCreate a tag TARGET_IMAGE that refers to SOURCE_IMAGE
docker topDisplay the running processes of a container
docker trustManage trust on Docker images
docker unpauseUnpause all processes within one or more containers
docker updateUpdate configuration of one or more containers
docker versionShow the Docker version information
docker volumeManage volumes
docker waitBlock until one or more containers stop, then print their exit codes

Sunday, 26 August 2018

return list of json spring boot rest controller

Let Say we have list of CarDetails Pojo and we want to return them back
@RestController
public class CarDetailController {
  @GetMapping("/viewAllCarDetailList")
    public List<CarDetail> retrieveAllCarDetails() {
        List<CarDetail> contacts = new ArrayList<CarDetail>();

        CarDetail objt = new CarDetail();
        objt.setCarModel("hyundai");
        objt.setSubModel("I10");
        CarDetail objt2 = new CarDetail();
        objt2.setCarModel("hyundai");
        objt2.setSubModel("I20");        
        contacts.add(objt);
        contacts.add(objt2);
        return contacts;
    }
}
    public class CarDetails {

            private String carModel;
            private String subModel;
// Will haave Setter getter and hash code equls method
//and constructor
    }
This JSON will be output:-
[
    {
        "carModel": "hyundai",
        "subModel": "I10"
    },
    {
        "carModel": "hyundai",
        "subModel": "I20"
    }
]

output in Postman

https://stackoverflow.com/questions/41719142/how-to-return-a-set-of-objects-with-spring-boot


Saturday, 18 August 2018

scala object hello world eclipse example

scala hello world eclipse

object HelloWorldScala {
  def main(args: Array[String]) {
    println("Hello Scala !!")
  }
}

output will be as like bellow

Hello Scala !!


spark-shell java was unexpected at this time

spark-shell java was unexpected at this time

You can see this issue when your Java home set like following in windows

JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_162\bin
Issue here is space in "Program Files (x86)" If you add double quotes will not work on window 10

"C:\Program Files (x86)\Java\jdk1.8.0_162\bin"
You need to copy Java into outside Program Files (x86) then it should work

JAVA_HOME=C:\java\jdk1.8.0_171\bin
--------------------------------------------------------------------------------------------------
Finally I upgraded my java version to JDK 1.8 for Spark!!!



spark shell cmd not recognized as an internal or external command

spark shell cmd not recognized as an internal or external command


I fixed it after following changes:

There were multiple Java/bin path in the System Path.
 So I corrected them to reflect single Java/Bin, which is in sync with JAVA_HOME

Added C:Windows\system32 to System Path Variable.


Saturday, 14 July 2018

hyperlink in HTML

<!DOCTYPE html>
<html>
<body>

<h2>hyperlink in  HTML </h2>
<p><a href="http://localhost:8080/addCarDetails">Visit our AddCarDetails</a></p>

</body>
</html>